Skip to main content

Discovering Concurrency Errors

  • Chapter
  • First Online:
Lectures on Runtime Verification

Abstract

Lots of concurrent software is being developed for the now ubiquitous multicore processors. And concurrent programming is difficult because it is quite easy to introduce errors that are really hard to diagnose and fix. One of the main obstacles to concurrent programming is that threads are scheduled nondeterministically and their interactions may become hard to predict and to devise. This chapter addresses the nature of concurrent programming and some classes of concurrency errors. It discusses the application of dynamic program analysis techniques to detect, locate and diagnose some common concurrency errors like data races, atomicity violations and deadlocks. This chapter also mentions some techniques that can help with quality assurance of concurrent programs, regardless of any particular class of concurrency errors, like noise injection and systematic testing, and it is closed by some prospects of concurrent software development.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 54.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 69.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    In this Chapter, we concentrate on the shared memory paradigm, leaving behind the distributed memory and message passing paradigms, which are covered elsewhere in this book.

  2. 2.

    Some atomicity violations can be, actually, seen as a low-level violations of ordering expectations and deadlocks, in addition, are often caused by a wrong order of locking operations. Here, we do not consider atomicity violations and deadlocks as order violations.

  3. 3.

    Mixed errors are errors that have both finite witnesses as well as infinite ones whose any finite prefix does not suffice as a witness.

References

  1. Power Framework Delay Fuzzing, April 2013. http://msdn.microsoft.com/en-us/library/hh454184(v=vs.85).aspx

  2. Agarwal, R., Stoller, S.D.: Run-time detection of potential deadlocks for programs with locks, semaphores, and condition variables. In: Proceedings of PADTAD 2006, pp. 51–60. ACM, New York (2006)

    Google Scholar 

  3. Agrawal, R., Imieliński, T., Swami, A.: Mining association rules between sets of items in large databases. In: Proceedings of the 1993 ACM SIGMOD International Conference on Management of Data, SIGMOD 1993, pp. 207–216. ACM, New York (1993)

    Google Scholar 

  4. Artho, C., Havelund, K., Biere, A.: High-level data races. In: The First International Workshop on Verification and Validation of Enterprise Information Systems, VVEIS 2003, Angers, France (2003)

    Google Scholar 

  5. Ayguade, E., Cristal, A., Unsal, O.S., Gagliardi, F., Smith, B., Valero, M., Harris, T.: Transactional memory: An overview. IEEE Micro 27, 8–29 (2007)

    Google Scholar 

  6. Bensalem, S., Havelund, K.: Dynamic deadlock analysis of multi-threaded programs. In: Ur, S., Bin, E., Wolfsthal, Y. (eds.) HVC 2005. LNCS, vol. 3875, pp. 208–223. Springer, Heidelberg (2006). https://doi.org/10.1007/11678779_15

    Chapter  Google Scholar 

  7. Bodden, E., Havelund, K.: Racer: Effective race detection using aspectj. In: Proceedings of the 2008 International Symposium on Software Testing and Analysis, ISSTA 2008, pp. 155–166. ACM, New York (2008)

    Google Scholar 

  8. Choi, J.D., Lee, K., Loginov, A., O’Callahan, R., Sarkar, V., Sridharan, M.: Efficient and precise datarace detection for multithreaded object-oriented programs. In: Proceedings of the ACM SIGPLAN 2002 Conference on Programming Language Design and Implementation, PLDI 2002, pp. 258–269. ACM, New York (2002)

    Google Scholar 

  9. Christiaens, M., De Bosschere, K.: TRaDe: Data race detection for java. In: Alexandrov, V.N., Dongarra, J.J., Juliano, B.A., Renner, R.S., Tan, C.J.K. (eds.) ICCS 2001. LNCS, vol. 2074, pp. 761–770. Springer, Heidelberg (2001). https://doi.org/10.1007/3-540-45718-6_81

    Chapter  Google Scholar 

  10. Coffman, E.G., Elphick, M., Shoshani, A.: System deadlocks. ACM Comput. Surv. 3, 67–78 (1971)

    Article  MATH  Google Scholar 

  11. Deshmukh, J., Emerson, E.A., Sankaranarayanan, S.: Symbolic deadlock analysis in concurrent libraries and their clients. In: Proceedings of the 2009 IEEE/ACM International Conference on Automated Software Engineering, ASE 2009, pp. 480–491. IEEE, Washington, DC (2009)

    Google Scholar 

  12. Dias, R.F., Ferreira, C., Fiedor, J., Lourenço, J.M., Smrčka, A., Sousa, D.G., Vojnar, T.: Verifying concurrent programs using contracts. In: Proceedings of ICST 2017. IEEE Computer Society, Washington, DC (2017)

    Google Scholar 

  13. Dias, R.J., Pessanha, V., Lourenço, J.M.: Precise detection of atomicity violations. In: Biere, A., Nahir, A., Vos, T. (eds.) HVC 2012. LNCS, vol. 7857, pp. 8–23. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-39611-3_8

    Chapter  Google Scholar 

  14. Edelstein, O., Farchi, E., Goldin, E., Nir, Y., Ratsaby, G., Ur, S.: Framework for testing multi-threaded java programs. Concurrency Comput. Pract. Experience 15(3–5), 485–499 (2003)

    Article  MATH  Google Scholar 

  15. Elmas, T., Qadeer, S., Tasiran, S.: Goldilocks: a race and transaction-aware java runtime. In: Proceedings of PLDI 2007, pp. 245–255. ACM, New York (2007)

    Google Scholar 

  16. Engler, D., Ashcraft, K.: RacerX: Effective, static detection of race conditions and deadlocks. SIGOPS Oper. Syst. Rev. 37(5), 237–252 (2003)

    Article  Google Scholar 

  17. Eswaran, K.P., Gray, J.N., Lorie, R.A., Traiger, I.L.: The notions of consistency and predicate locks in a database system. Commun. ACM 19, 624–633 (1976). http://doi.acm.org/10.1145/360363.360369

    Article  MathSciNet  MATH  Google Scholar 

  18. Farchi, E., Nir, Y., Ur, S.: Concurrent bug patterns and how to test them. In: Proceedings of the 17th International Symposium on Parallel and Distributed Processing, IPDPS 2003, p. 286.2. IEEE Computer Society, Washington, DC (2003)

    Google Scholar 

  19. Fiedor, J., Křena, B., Letko, Z., Vojnar, T.: A uniform classification of common concurrency errors. In: Moreno-Díaz, R., Pichler, F., Quesada-Arencibia, A. (eds.) EUROCAST 2011. LNCS, vol. 6927, pp. 519–526. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-27549-4_67

    Chapter  Google Scholar 

  20. Fiedor, J., Letko, Z., Lourenço, J., Vojnar, T.: Dynamic validation of contracts in concurrent code. In: Moreno-Díaz, R., Pichler, F., Quesada-Arencibia, A. (eds.) EUROCAST 2015. LNCS, vol. 9520, pp. 555–564. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-27340-2_69

    Chapter  Google Scholar 

  21. Fiedor, J., Vojnar, T.: Noise-based testing and analysis of multi-threaded C/C++ programs on the binary level. In: PADTAD 2012, pp. 36–46. ACM (2012)

    Google Scholar 

  22. Fiedor, J., Vojnar, T.: ANaConDA: A framework for analysing multi-threaded C/C++ programs on the binary level. In: Qadeer, S., Tasiran, S. (eds.) RV 2012. LNCS, vol. 7687, pp. 35–41. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-35632-2_5

    Chapter  Google Scholar 

  23. Flanagan, C., Freund, S.N.: Type-based race detection for java. In: Proceedings of the ACM SIGPLAN 2000 Conference on Programming Language Design and Implementation, PLDI 2000, pp. 219–232. ACM, New York (2000)

    Google Scholar 

  24. Flanagan, C., Freund, S.N.: Atomizer: A dynamic atomicity checker for multithreaded programs. SIGPLAN Not. 39(1), 256–267 (2004)

    Article  MATH  Google Scholar 

  25. Flanagan, C., Freund, S.N.: Type inference against races. Sci. Comput. Program. 64(1), 140–165 (2007)

    Article  MathSciNet  MATH  Google Scholar 

  26. Flanagan, C., Freund, S.N.: FastTrack: efficient and precise dynamic race detection. In: Proceedings of the 2009 ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2009, pp. 121–133. ACM, New York (2009)

    Google Scholar 

  27. Flanagan, C., Freund, S.N.: The roadrunner dynamic analysis framework for concurrent programs. In: Proceedings of the 9th ACM SIGPLAN-SIGSOFT Workshop on Program Analysis for Software Tools and Engineering, PASTE 2010, pp. 1–8. ACM, New York (2010). http://doi.acm.org/10.1145/1806672.1806674

  28. Flanagan, C., Freund, S.N., Lifshin, M., Qadeer, S.: Types for atomicity: static checking and inference for java. ACM Trans. Program. Lang. Syst. 30(4), 1–53 (2008)

    Article  Google Scholar 

  29. Flanagan, C., Freund, S.N., Yi, J.: Velodrome: A sound and complete dynamic atomicity checker for multithreaded programs. SIGPLAN Not. 43(6), 293–303 (2008)

    Article  Google Scholar 

  30. Godefroid, P.: Software model checking: The verisoft approach. Form. Methods Syst. Des. 26(2), 77–101 (2005)

    Article  Google Scholar 

  31. Goubault, E.: Geometry and concurrency: a user’s guide. Math. Struct. Comput. Sci. 10(4), 411–425 (2000)

    Article  MathSciNet  MATH  Google Scholar 

  32. Hammer, C., Dolby, J., Vaziri, M., Tip, F.: Dynamic detection of atomic-set-serializability violations. In: Proceedings of the 30th International Conference on Software Engineering, ICSE 2008, pp. 231–240. ACM, New York (2008)

    Google Scholar 

  33. Havelund, K.: Using runtime analysis to guide model checking of java programs. In: Havelund, K., Penix, J., Visser, W. (eds.) SPIN 2000. LNCS, vol. 1885, pp. 245–264. Springer, Heidelberg (2000). https://doi.org/10.1007/10722468_15

    Chapter  Google Scholar 

  34. Ho, A., Smith, S., Hand, S.: On deadlock, livelock, and forward progress. University of Cambridge, Technical report (2005)

    Google Scholar 

  35. Holzmann, G.: Spin Model Checker, The: Primer and Reference Manual. Addison-Wesley Professional, Reading (2003)

    Google Scholar 

  36. Hong, S., Ahn, J., Park, S., Kim, M., Harrold, M.J.: Testing concurrent programs to achieve high synchronization coverage. In: Proceedings of ISSTA 2012, pp. 210–220. ACM, New York (2012)

    Google Scholar 

  37. Hovemeyer, D., Pugh, W.: Finding concurrency bugs in java. In: 23rd Annual ACM SIGACTSIGOPS Symposium on Principles of Distributed Computing (PODC 2004) Workshop on Concurrency and Programs, July 2004

    Google Scholar 

  38. Joshi, P., Park, C.S., Sen, K., Naik, M.: A randomized dynamic program analysis technique for detecting real deadlocks. In: Proceedings of the 2009 ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2009, pp. 110–120. ACM, New York (2009)

    Google Scholar 

  39. Kahlon, V., Yang, Y., Sankaranarayanan, S., Gupta, A.: Fast and accurate static data-race detection for concurrent programs. In: Damm, W., Hermanns, H. (eds.) CAV 2007. LNCS, vol. 4590, pp. 226–239. Springer, Heidelberg (2007). https://doi.org/10.1007/978-3-540-73368-3_26

    Chapter  Google Scholar 

  40. Kim, K., Yavuz-Kahveci, T., Sanders, B.A.: Precise data race detection in a relaxed memory model using heuristic-based model checking. In: ASE, pp. 495–499. IEEE (2009)

    Google Scholar 

  41. Křena, B., Letko, Z., Tzoref, R., Ur, S., Vojnar, T.: Healing data races on-the-fly. In: Proceedings of PADTAD 2007, pp. 54–64. ACM, New York (2007)

    Google Scholar 

  42. Lamport, L.: How to make a multiprocessor computer that correctly executes multiprocess programs. IEEE Trans. Comput. 28(9), 690–691 (1979). https://doi.org/10.1109/TC.1979.1675439

    Article  MATH  Google Scholar 

  43. Lamport, L.: Time, clocks, and the ordering of events in a distributed system. Commun. ACM 21(7), 558–565 (1978)

    Article  MATH  Google Scholar 

  44. Laurenzano, M., Tikir, M., Carrington, L., Snavely, A.: PEBIL: Efficient static binary instrumentation for linux. In: ISPASS 2010, pp. 175–183 (2010)

    Google Scholar 

  45. Letko, Z., Vojnar, T., Křena, B.: Atomrace: Data race and atomicity violation detector and healer. In: Proceedings of the 6th Workshop on Parallel and Distributed Systems: Testing, Analysis, and Debugging, PADTAD 2008, pp. 7:1–7:10. ACM, New York (2008). http://doi.acm.org/10.1145/1390841.1390848

  46. Lipton, R.J.: Reduction: A method of proving properties of parallel programs. Commun. ACM 18(12), 717–721 (1975)

    Article  MathSciNet  MATH  Google Scholar 

  47. Lu, S., Park, S., Hu, C., Ma, X., Jiang, W., Li, Z., Popa, R.A., Zhou, Y.: MUVI: Automatically inferring multi-variable access correlations and detecting related semantic and concurrency bugs. SIGOPS Oper. Syst. Rev. 41(6), 103–116 (2007)

    Article  Google Scholar 

  48. Lu, S., Tucek, J., Qin, F., Zhou, Y.: AVIO: Detecting atomicity violations via access interleaving invariants. In: Proceedings of ASPLOS 2006, pp. 37–48. ACM, New York (2006)

    Google Scholar 

  49. Luk, C.K., Cohn, R., Muth, R., Patil, H., Klauser, A., Lowney, G., Wallace, S., Reddi, V.J., Hazelwood, K.: Pin: building customized program analysis tools with dynamic instrumentation. In: Proceedings of PLDI 2005. ACM (2005)

    Google Scholar 

  50. Masticola, S.P., Ryder, B.G.: Non-concurrency analysis. In: Proceedings of the Fourth ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, PPOPP 1993, pp. 129–138. ACM, New York (1993)

    Google Scholar 

  51. Mattern, F.: Virtual time and global states of distributed systems. In: Proceedings of the International Workshop on Parallel and Distributed Algorithms. Elsevier Science Publishers (1988). http://citeseer.ist.psu.edu/mattern89virtual.html

  52. Musuvathi, M., Qadeer, S., Ball, T.: CHESS: A Systematic Testing Tool for Concurrent Software. Technical report MSR-TR-2007-149, Microsoft Research (2007)

    Google Scholar 

  53. Musuvathi, M., Qadeer, S., Ball, T., Basler, G., Nainar, P.A., Neamtiu, I.: Finding and reproducing heisenbugs in concurrent programs. In: OSDI 2008, pp. 267–280. USENIX Association, Berkeley (2008). http://dl.acm.org/citation.cfm?id=1855741.1855760

  54. Naik, M., Aiken, A., Whaley, J.: Effective static race detection for java. SIGPLAN Not. 41(6), 308–319 (2006)

    Article  Google Scholar 

  55. Nethercote, N., Seward, J.: Valgrind: a framework for heavyweight dynamic binary instrumentation. In: PLDI 2007, pp. 89–100. ACM, New York (2007). http://doi.acm.org/10.1145/1250734.1250746

  56. Nir-Buchbinder, Y., Tzoref, R., Ur, S.: Deadlocks: from exhibiting to healing. In: Leucker, M. (ed.) RV 2008. LNCS, vol. 5289, pp. 104–118. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-89247-2_7

    Chapter  Google Scholar 

  57. Nonaka, Y., Ushijima, K., Serizawa, H., Murata, S., Cheng, J.: A run-time deadlock detector for concurrent java programs. In: Proceedings of the Eighth Asia-Pacific on Software Engineering Conference, APSEC 2001, p. 45. IEEE, Washington, DC (2001)

    Google Scholar 

  58. O’Callahan, R., Choi, J.D.: Hybrid dynamic data race detection. In: Proceedings of the Ninth ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, PPoPP 2003, pp. 167–178. ACM, New York (2003)

    Google Scholar 

  59. Park, S., Vuduc, R.W., Harrold, M.J.: Falcon: Fault localization in concurrent programs. In: Proceedings of the 32nd ACM/IEEE International Conference on Software Engineering - Volume 1, ICSE 2010, pp. 245–254. ACM, New York (2010). http://doi.acm.org/10.1145/1806799.1806838

  60. Poulsen, K.: Tracking the blackout bug (2004). http://www.securityfocus.com/news/8412

  61. Pozniansky, E., Schuster, A.: Efficient on-the-fly data race detection in multithreaded C++ programs. In: Proceedings of PPoPP 2003, pp. 179–190. ACM, New York (2003)

    Google Scholar 

  62. Pozniansky, E., Schuster, A.: MultiRace: efficient on-the-fly data race detection in multithreaded C++ programs: research articles. Concurr. Comput. Pract. Exper. 19(3), 327–340 (2007)

    Article  Google Scholar 

  63. von Praun, C., Gross, T.R.: Object race detection. In: Proceedings of OOPSLA 2001, pp. 70–82. ACM, New York (2001)

    Google Scholar 

  64. Savage, S., Burrows, M., Nelson, G., Sobalvarro, P., Anderson, T.: Eraser: a dynamic data race detector for multi-threaded programs. In: Proceedings of SOSP 1997, pp. 27–37. ACM, New York (1997)

    Google Scholar 

  65. Sousa, D.G., Dias, R.J., Ferreira, C., Lourenço, J.M.: Preventing atomicity violations with contracts, May 2015. arXiv preprint arXiv:1505.02951

  66. Vaziri, M., Tip, F., Dolby, J.: Associating synchronization constraints with data in an object-oriented language. In: Conference Record of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2006, pp. 334–345. ACM, New York (2006)

    Google Scholar 

  67. Visser, W., Havelund, K., Brat, G., Park, S.: Model checking programs. In: Proceedings of ASE 2000, p. 3. IEEE Computer Society, Washington, DC (2000)

    Google Scholar 

  68. Wang, L., Stoller, S.D.: Static analysis of atomicity for programs with non-blocking synchronization. In: Proceedings of the Tenth ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, PPoPP 2005, pp. 61–71. ACM, New York (2005)

    Google Scholar 

  69. Wang, L., Stoller, S.D.: Runtime analysis of atomicity for multithreaded programs. IEEE Trans. Softw. Eng. 32(2), 93–110 (2006)

    Article  Google Scholar 

  70. Williams, A., Thies, W., Ernst, M.D.: Static deadlock detection for java libraries. In: Black, A.P. (ed.) ECOOP 2005. LNCS, vol. 3586, pp. 602–629. Springer, Heidelberg (2005). https://doi.org/10.1007/11531142_26

    Chapter  Google Scholar 

  71. Wu, J., Tang, Y., Hu, G., Cui, H., Yang, J.: Sound and precise analysis of parallel programs through schedule specialization. In: Proceedings of PLDI 2012, pp. 205–216. ACM, New York (2012)

    Google Scholar 

  72. Xu, M., Bodík, R., Hill, M.D.: A serializability violation detector for shared-memory server programs. SIGPLAN Not. 40(6), 1–14 (2005)

    Article  Google Scholar 

  73. Yang, Y., Gringauze, A., Wu, D., Rohde, H.: Detecting Data Race and Atomicity Violation via Typestate-Guided Static Analysis. Technical report MSR-TR-2008-108, Microsoft Research (2008)

    Google Scholar 

  74. Yu, J., Narayanasamy, S.: A case for an interleaving constrained shared-memory multi-processor. SIGARCH Comput. Archit. News 37(3), 325–336 (2009)

    Article  Google Scholar 

  75. Yu, J., Narayanasamy, S., Pereira, C., Pokam, G.: Maple: A coverage-driven testing tool for multithreaded programs. In: Proceedings of OOPSLA 2012, pp. 485–502. ACM, New York (2012)

    Google Scholar 

  76. Yu, Y., Rodeheffer, T., Chen, W.: RaceTrack: efficient detection of data race conditions via adaptive tracking. SIGOPS Oper. Syst. Rev. 39(5), 221–234 (2005)

    Article  Google Scholar 

  77. Zhang, W., Sun, C., Lu, S.: ConMem: detecting severe concurrency bugs through an effect-oriented approach. In: Proceedings of the Fifteenth Edition of ASPLOS on Architectural Support for Programming Languages and Operating Systems, ASPLOS 2010, pp. 179–192. ACM, New York (2010)

    Google Scholar 

Download references

Acknowledgment

This work was partially supported by the ARVI EU COST ACTION IC1402. Further, the Czech authors were supported by the EU ECSEL project Aquas, the internal BUT FIT project FIT-S-17-4014, and the IT4IXS project: IT4Innovations Excellence in Science (LQ1602). The Portuguese author was also supported by the Portuguese Science Foundation and NOVA LINCS (ref. UID/CEC/04516/2013).

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to João M. Lourenço .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2018 Springer International Publishing AG

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Lourenço, J.M., Fiedor, J., Křena, B., Vojnar, T. (2018). Discovering Concurrency Errors. In: Bartocci, E., Falcone, Y. (eds) Lectures on Runtime Verification. Lecture Notes in Computer Science(), vol 10457. Springer, Cham. https://doi.org/10.1007/978-3-319-75632-5_2

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-75632-5_2

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-75631-8

  • Online ISBN: 978-3-319-75632-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics