Gadara: Dynamic Deadlock Avoidance for Multithreaded Programs

Deadlock is an increasingly pressing concern as the multicore revolution forces parallel programming upon the average programmer. Existing approaches to deadlock impose onerous burdens on developers, entail high runtime performance overheads, or offer no help for unmodified legacy code. Gadara automates dynamic deadlock avoidance for conventional multithreaded programs. It employs whole-program static analysis to model programs, and Discrete Control Theory to synthesize lightweight, decentralized, highly concurrent logic that controls them at runtime. Gadara is safe, and can be applied to legacy code with modest programmer effort. Gadara is efficient because it performs expensive deadlock-avoidance computations offline rather than online. We have implemented Gadara for C/Pthreads programs. In benchmark tests, Gadara successfully avoids injected deadlock faults, imposes negligible to modest performance overheads (at most 18%), and outperforms a software transactional memory system. Tests on a real application show that Gadara identifies and avoids both previously known and unknown deadlocks while adding performance overheads ranging from negligible to 10%.

[1]  Yuanyuan Zhou,et al.  Learning from mistakes: a comprehensive study on real world concurrency bug characteristics , 2008, ASPLOS.

[2]  Christos G. Cassandras,et al.  Introduction to Discrete Event Systems , 1999, The Kluwer International Series on Discrete Event Dynamic Systems.

[3]  Rahul Agarwal,et al.  Detecting Potential Deadlocks with Static Analysis and Run-Time Monitoring , 2005, Haifa Verification Conference.

[4]  Maged M. Michael,et al.  Implementing and Exploiting Inevitability in Software Transactional Memory , 2008, 2008 37th International Conference on Parallel Processing.

[5]  Edsger W. Dijkstra,et al.  Solution of a problem in concurrent programming control , 1965, CACM.

[6]  Rahul Agarwal,et al.  Run-time detection of potential deadlocks for programs with locks, semaphores, and condition variables , 2006, PADTAD '06.

[7]  Joaquín Ezpeleta,et al.  Some improvements to the Banker's algorithm based on the process structure , 2000, Proceedings 2000 ICRA. Millennium Conference. IEEE International Conference on Robotics and Automation. Symposia Proceedings (Cat. No.00CH37065).

[8]  Greg Nelson,et al.  Extended static checking for Java , 2002, PLDI '02.

[9]  Terence Kelly,et al.  Discrete control for safe execution of IT automation workflows , 2007, EuroSys '07.

[10]  Richard C. Holt,et al.  Comments on prevention of system deadlocks , 1971, Commun. ACM.

[11]  Erwin R. Boer,et al.  Generating basis siphons and traps of Petri nets using the sign incidence matrix , 1994 .

[12]  A. Nico Habermann,et al.  Prevention of system deadlocks , 1969, CACM.

[13]  Sheau-Dong Lang An Extended Banker's Algorithm for Deadlock Avoidance , 1999, IEEE Trans. Software Eng..

[14]  Adam Welc,et al.  Irrevocable transactions and their applications , 2008, SPAA '08.

[15]  Krishna M. Kavi,et al.  Modeling Multithreaded Applications Using Petri Nets , 2002, International Journal of Parallel Programming.

[16]  Edsger W. Dijkstra,et al.  Solution of a problem in concurrent programming control , 1965, CACM.

[17]  Panos J. Antsaklis,et al.  Supervisory Control of Concurrent Systems: A Petri Net Structural Approach (M.V. Iordache and P.J. Antsaklis; 2008) [Book reviews] , 2006, IEEE Transactions on Automatic Control.

[18]  Edward A. Lee The problem with threads , 2006, Computer.

[19]  Donald E. Knuth,et al.  Additional comments on a problem in concurrent programming control , 1966, CACM.

[20]  James R. Larus,et al.  Transactional memory , 2008, CACM.

[21]  Yin Wang,et al.  The application of supervisory control to deadlock avoidance in concurrent software , 2008, 2008 9th International Workshop on Discrete Event Systems.

[22]  Yixin Diao,et al.  Feedback Control of Computing Systems , 2004 .

[23]  James R. Larus,et al.  Transactional Memory , 2006, Transactional Memory.

[24]  Spyros Reveliotis Real-time management of resource allocation systems : a discrete event systems approach , 2004 .

[25]  Craig B. Zilles,et al.  An Analysis of I/O And Syscalls In Critical Sections And Their Implications For Transactional Memory , 2008, ISPASS 2008 - IEEE International Symposium on Performance Analysis of Systems and software.

[26]  Christos G. Cassandras,et al.  Introduction to Discrete Event Systems, Second Edition , 2008 .

[27]  Dieter Zöbel,et al.  Resolution techniques and complexity results with deadlocks: a classifying and annotated bibliography , 1988, OPSR.

[28]  Adam Welc,et al.  Design and implementation of transactional constructs for C/C++ , 2008, OOPSLA '08.

[29]  Panos J. Antsaklis,et al.  Supervisory Control of Discrete Event Systems Using Petri Nets , 1998, The International Series on Discrete Event Dynamic Systems.

[30]  Tadao Murata,et al.  Petri nets: Properties, analysis and applications , 1989, Proc. IEEE.

[31]  Yuanyuan Zhou,et al.  Rx: treating bugs as allergies---a safe method to survive software failures , 2005, SOSP '05.

[32]  Michael Burrows,et al.  Eraser: a dynamic data race detector for multithreaded programs , 1997, TOCS.

[33]  Glen E. Newton Deadlock prevention, detection, and resolution: an annotated bibliography , 1979, OPSR.

[34]  Shmuel Ur,et al.  Deadlocks: From Exhibiting to Healing , 2008, RV.

[35]  Edmund M. Clarke,et al.  Model Checking , 1999, Handbook of Automated Reasoning.

[36]  E. Mark Gold,et al.  Deadlock Prediction: Easy and Difficult Cases , 1978, SIAM J. Comput..

[37]  James R. Larus,et al.  Software and the Concurrency Revolution , 2005, ACM Queue.

[38]  Richard C. Holt,et al.  Some deadlock properties of computer systems , 1971, SOSP '71.

[39]  Alessandro Giua,et al.  A Survey of Petri Net Methods for Controlled Discrete Event Systems , 1997, Discret. Event Dyn. Syst..

[40]  Raphael A. Finkel,et al.  An Efficient Deadlock Avoidance Algorithm , 1987, Inf. Process. Lett..

[41]  Horatiu Jula,et al.  A Scalable, Sound, Eventually-Complete Algorithm for Deadlock Immunity , 2008, RV.

[42]  Mark S. Miller,et al.  Robust composition: towards a unified approach to access control and concurrency control , 2006 .

[43]  MengChu Zhou,et al.  A Survey and Comparison of Petri Net-Based Deadlock Prevention Policies for Flexible Manufacturing Systems , 2008, IEEE Transactions on Systems, Man, and Cybernetics, Part C (Applications and Reviews).

[44]  Edsger W. Dijkstra,et al.  Cooperating sequential processes , 2002 .

[45]  William Landi,et al.  Undecidability of static analysis , 1992, LOPL.

[46]  Adam Wierman,et al.  Open Versus Closed: A Cautionary Tale , 2006, NSDI.

[47]  Edsger W. Dijkstra,et al.  The Mathematics Behind the Banker’s Algorithm , 1982 .

[48]  Toshimi Minoura,et al.  Deadlock avoidance revisited , 1982, JACM.

[49]  Dawson R. Engler,et al.  RacerX: effective, static detection of race conditions and deadlocks , 2003, SOSP '03.