Discrete Event Dynamic Systems

, Volume 23, Issue 2, pp 157–195 | Cite as

Concurrency bugs in multithreaded software: modeling and analysis using Petri nets

  • Hongwei Liao
  • Yin Wang
  • Hyoun Kyu Cho
  • Jason Stanley
  • Terence Kelly
  • Stéphane Lafortune
  • Scott Mahlke
  • Spyros Reveliotis
Article

Abstract

In this paper, we apply discrete-event system techniques to model and analyze the execution of concurrent software. The problem of interest is deadlock avoidance in shared-memory multithreaded programs. We employ Petri nets to systematically model multithreaded programs with lock acquisition and release operations. We define a new class of Petri nets, called Gadara nets, that arises from this modeling process. We investigate a set of important properties of Gadara nets, such as liveness, reversibility, and linear separability. We propose efficient algorithms for the verification of liveness of Gadara nets, and report experimental results on their performance. We also present modeling examples of real-world programs. The results in this paper lay the foundations for the development of effective control synthesis algorithms for Gadara nets.

Keywords

Concurrent software Deadlock analysis Modeling Petri nets 

References

  1. Allen LV (2010) Verification and anomaly detection for event-based control of manufacturing systems. PhD thesis, University of MichiganGoogle Scholar
  2. Auer A, Dingel J, Rudie K (2009) Concurrency control generation for dynamic threads using discrete-event systems. In: Proc. Allerton conference on communication, control and computingGoogle Scholar
  3. Boer ER, Murata T (1994) Generating basis siphons and traps of Petri nets using the sign incidence matrix. IEEE Trans Circuits Syst—I 41(4):266–271MathSciNetCrossRefGoogle Scholar
  4. Cano EE, Rovetto CA, Colom JM (2010) An algorithm to compute the minimal siphons in S 4 PR nets. In: Proc. international workshop on discrete event systems, pp 18–23Google Scholar
  5. Cassandras CG, Lafortune S (2008) Introduction to discrete event systems, 2nd edn. Springer, BostonMATHCrossRefGoogle Scholar
  6. Chu F, Xie XL (1997) Deadlock analysis of Petri nets using siphons and mathematical programming. IEEE Trans Robot Autom 13(6):793–804CrossRefGoogle Scholar
  7. Delaval G, Marchand H, Rutten E (2010) Contracts for modular discrete controller synthesis. In: Proc. ACM conference on languages, compilers and tools for embedded systemsGoogle Scholar
  8. Dijkstra EW (1982) The mathematics behind the Banker’s Algorithm. In: Selected Writings on Computing: A Personal Perspective. Springer-Verlag, New York, pp 308–312CrossRefGoogle Scholar
  9. Dragert C, Dingel J, Rudie K (2008) Generation of concurrency control code using discrete-event systems theory. In: Proc. ACM international symposium on foundations of software engineeringGoogle Scholar
  10. Engler D, Ashcraft K (2003) RacerX: effective, static detection of race conditions and deadlocks. In: Proc. the 19th ACM symposium on operating systems principlesGoogle Scholar
  11. Ezpeleta J, Colom JM, Martínez J (1995) A Petri net based deadlock prevention policy for flexible manufacturing systems. IEEE Trans Robot Autom 11(2):173–184CrossRefGoogle Scholar
  12. Ezpeleta J, García-Vallés F, Colom JM (2002) A banker’s solution for deadlock avoidance in FMS with flexible routing and multiresource states. IEEE Trans Robot Autom 18(4):621–625CrossRefGoogle Scholar
  13. Flanagan C, Leino KRM, Lillibridge M, Nelson G, Saxe JB, Stata R (2002) Extended static checking for Java. In: Proc. the ACM SIGPLAN 2002 conference on programming language design and implementationGoogle Scholar
  14. Gamatie A, Yu H, Delaval G, Rutten E (2009) A case study on controller synthesis for data-intensive embedded system. In: Proc. international conference on embedded software and systemsGoogle Scholar
  15. Giua A (1992) Petri nets as discrete event models for supervisory control. PhD thesis, Rensselaer Polytechnic InstituteGoogle Scholar
  16. Gurobi (2010) Gurobi optimizer. http://www.gurobi.com/
  17. Hopcroft JE, Motwani R, Ullman JD (2006) Introduction to automata theory, languages, and computation, 3rd edn. Addison WesleyGoogle Scholar
  18. Iordache MV, Antsaklis PJ (2006) Supervisory control of concurrent systems: a Petri net structural approach. Birkhäuser, BostonMATHGoogle Scholar
  19. Iordache MV, Antsaklis PJ (2009) Petri nets and programming: a survey. In: Proc. 2009 American control conference, pp 4994–4999Google Scholar
  20. Iordache MV, Antsaklis PJ (2010) Concurrent program synthesis based on supervisory control. In: Proc. 2010 American control conference, pp 3378–3383Google Scholar
  21. Jeng M, Xie X (2001) Modeling and analysis of semiconductor manufacturing systems with degraded behaviors using Petri nets and siphons. IEEE Trans Robot Autom 17(5):576–588CrossRefGoogle Scholar
  22. Kavi KM, Moshtaghi A, Chen D (2002) Modeling multithreaded applications using Petri nets. Int J Parallel Program 35(5):353–371CrossRefGoogle Scholar
  23. Kelly T, Wang Y, Lafortune S, Mahlke S (2009) Eliminating concurrency bugs with control engineering. IEEE Computer 42(12):52–60CrossRefGoogle Scholar
  24. Li Z, Zhou M, Wu N (2008) A survey and comparison of Petri net-based deadlock prevention policies for flexible manufacturing systems. IEEE Trans Syst Man Cybern Part C 38(2):173–188MATHCrossRefGoogle Scholar
  25. Liao H, Lafortune S, Reveliotis S, Wang Y, Mahlke S (2010) Synthesis of maximally-permissive liveness-enforcing control policies for Gadara Petri nets. In: Proc. the 49th IEEE conference on decision and controlGoogle Scholar
  26. Liao H, Stanley J, Wang Y, Lafortune S, Reveliotis S, Mahlke S (2011) Deadlock-avoidance control of multithreaded software: an efficient siphon-based algorithm for Gadara Petri nets. In: Proc. the 50th IEEE conference on decision and controlGoogle Scholar
  27. Liu C, Kondratyev A, Watanabe Y, Desel J, Sangiovanni-Vincentelli A (2006) Schedulability analysis of Petri nets based on structural properties. In: Proc. international conference on application of concurrency to system designGoogle Scholar
  28. Murata T (1989) Petri nets: properties, analysis and applications. Proc IEEE 77(4):541–580CrossRefGoogle Scholar
  29. Murata T, Shenker B, Shatz SM (1989) Detection of Ada static deadlocks using Petri net invariants. IEEE Trans Softw Eng 15(3):314–326CrossRefGoogle Scholar
  30. Musuvathi M, Qadeer S, Ball T, Basler G, Nainar PA, Neamtiu I (2008) Finding and reproducing Heisenbugs in concurrent programs. In: Proc. the 8th USENIX symposium on operating systems design and implementationGoogle Scholar
  31. Nazeem A, Reveliotis S, Wang Y, Lafortune S (2010) Optimal deadlock avoidance for complex resource allocation systems through classification theory. In: Proc. the 10th international workshop on discrete event systemsGoogle Scholar
  32. Nazeem A, Reveliotis S, Wang Y, Lafortune S (2011) Designing compact and maximally permissive deadlock avoidance policies for complex resource allocation systems through classification theory: the linear case. IEEE Trans Autom Control 56(8):1818–1833MathSciNetCrossRefGoogle Scholar
  33. Nir-Buchbinder Y, Tzoref R, Ur S (2008) Deadlocks: From exhibiting to healing. In: Proc. workshop on runtime verificationGoogle Scholar
  34. Novark G, Berger ED, Zorn BG (2007) Exterminator: automatically correcting memory errors with high probability. In: Proc. programming language design and implementationGoogle Scholar
  35. Novark G, Berger ED, Zorn BG (2008) Exterminator: automatically correcting memory errors with high probability. Commun ACM 51(12):87–95CrossRefGoogle Scholar
  36. Park J, Reveliotis SA (2001) Deadlock avoidance in sequential resource allocation systems with multiple resource acquisitions and flexible routings. IEEE Trans Autom Control 46(10):1572–1583MathSciNetMATHCrossRefGoogle Scholar
  37. Park J, Reveliotis SA (2002) Liveness-enforcing supervision for resource allocation systems with uncontrollable behavior and forbidden states. IEEE Trans Robot Autom 18(2):234–240CrossRefGoogle Scholar
  38. Park S, Lu S, Zhou Y (2009) Ctrigger: exposing atomicity violation bugs from their hiding places. In: Proc. 14th international conference on architecture support for programming languages and operating systemsGoogle Scholar
  39. Phoha VV, Nadgar AU, Ray A, Phoha S (2004) Supervisory control of software systems. IEEE Trans Comput 53(9):1187–1199CrossRefGoogle Scholar
  40. Qin F, Tucek J, Sundaresan J, Zhou Y (2005) Rx: treating bugs as allergies—a safe method to survive software failures. In: Proc. the 20th ACM symposium on operating systems principles, pp 235–248Google Scholar
  41. Reisig W (1985) Petri nets: an introduction. Springer, New YorkMATHGoogle Scholar
  42. Reveliotis SA (2005) Real-time management of resource allocation systems: a discrete-event systems approach. Springer, New YorkMATHGoogle Scholar
  43. Sutter H, Larus J (2005) Software and the concurrency revolution. ACM Queue 3(7):54–62CrossRefGoogle Scholar
  44. Wallace C, Jensen P, Soparkar N (1996) Supervisory control of workflow scheduling. In: Proc. international workshop on advanced transaction models and architecturesGoogle Scholar
  45. Wang Y (2009) Software failure avoidance using discrete control theory. PhD thesis, University of MichiganGoogle Scholar
  46. Wang Y, Kelly T, Kudlur M, Lafortune S, Mahlke SA (2008) Gadara: dynamic deadlock avoidance for multithreaded programs. In: Proc. the 8th USENIX symposium on operating systems design and implementation, pp 281–294Google Scholar
  47. Wang Y, Lafortune S, Kelly T, Kudlur M, Mahlke S (2009a) The theory of deadlock avoidance via discrete control. In: Proc. the 36th annual ACM SIGPLAN-SIGACT symposium on principles of programming languages, pp 252–263Google Scholar
  48. Wang Y, Liao H, Reveliotis S, Kelly T, Mahlke S, Lafortune S (2009b) Gadara nets: Modeling and analyzing lock allocation for deadlock avoidance in multithreaded software. In: Proc. the 48th IEEE conference on decision and control, pp 4971–4976Google Scholar
  49. Wang Y, Cho HK, Liao H, Nazeem A, Kelly TP, Lafortune S, Mahlke S, Reveliotis S (2010) Supervisory control of software execution for failure avoidance: experience from the Gadara project. In: Proc. international workshop on discrete event systemsGoogle Scholar
  50. Yamalidou K, Moody J, Lemmon M, Antsaklis P (1996) Feedback control of Petri nets based on place invariants. Automatica 32(1):15–28MathSciNetMATHCrossRefGoogle Scholar

Copyright information

© Springer Science+Business Media, LLC 2012

Authors and Affiliations

  • Hongwei Liao
    • 1
  • Yin Wang
    • 2
  • Hyoun Kyu Cho
    • 1
  • Jason Stanley
    • 1
  • Terence Kelly
    • 2
  • Stéphane Lafortune
    • 1
  • Scott Mahlke
    • 1
  • Spyros Reveliotis
    • 3
  1. 1.Department of Electrical Engineering and Computer ScienceUniversity of MichiganAnn ArborUSA
  2. 2.HP LabsPalo AltoUSA
  3. 3.School of Industrial & Systems EngineeringGeorgia Institute of TechnologyAtlantaUSA

Personalised recommendations