Static Analysis of Concurrency Constructs in Higher-Order Programs

Detecting and debugging concurrency bugs is particularly hard. The complexity of concurrent programs is huge due to the exponential number of possible interleavings between the multiple units of execution of those programs. Having help from the computer to detect concurrency bugs — or prove their absence — can substantially reduce debugging time. In this dissertation, we investigate the use of abstract interpretation to detect race conditions and deadlocks in concurrent programs. We use the PCESK machine, as described by Might and Van Horn, to compute an over-approximation of the set of states reachable by a concurrent program. We provide a number of benchmarks to analyze the influence of garbage collection and state subsumption on the performance of this machine in terms of state space size and analysis time. We define several analyses that use the computed set of reachable states to deduce relevant properties of a concurrent program. Race condition analysis and deadlock analysis are the most notable analyses we develop. Although both these analyses are unsound and thus might miss some defects, they exhibit high precision and recall, allowing them to detect a good portion of bugs in relatively short programs. This dissertation shows that it is possible to use the PCESK machine for building useful analyses to detect race conditions and deadlocks. The main limitation of this approach is the size of the state spaces involved in the analyses. We therefore investigate the PCESKL machine, a variant of the PCESK machine that uses first-class locks instead of cas (compare-and-swap) as a synchronization primitive. We find that the PCESKL machine leads to simplified analyses and reduced state space size, resulting in reduced analysis time. This machine is therefore more suited for analyzing longer and more complex programs.

[1]  Suresh Jagannathan,et al.  Analyzing stores and references in a parallel symbolic language , 1994, LFP '94.

[2]  David K. Gifford,et al.  Design Concepts in Programming Languages , 2008 .

[3]  Martin Rinard,et al.  Safejava: a unified type system for safe programming , 2004 .

[4]  Suresh Jagannathan,et al.  Locality Abstractions for Parallel and Distributed Computing , 1994, Theory and Practice of Parallel Programming.

[5]  Keir Fraser,et al.  Practical lock-freedom , 2003 .

[6]  Michael D. Ernst,et al.  Static Deadlock Detection for Java Libraries , 2005, ECOOP.

[7]  Martin C. Rinard,et al.  A parameterized type system for race-free Java programs , 2001, OOPSLA '01.

[8]  Alexander Aiken,et al.  Conditional must not aliasing for static race detection , 2007, POPL '07.

[9]  Eran Yahav,et al.  Cartesian Partial-Order Reduction , 2007, SPIN.

[10]  Martín Abadi,et al.  Types for Safe Locking , 1999, ESOP.

[11]  Matthew Might,et al.  Abstracting abstract machines , 2010, ICFP '10.

[12]  Christoph von Praun,et al.  Detecting synchronization defects in multi-threaded object-oriented programs , 2004 .

[13]  Suresh Jagannathan,et al.  A concurrent abstract interpreter , 1994, LISP Symb. Comput..

[14]  Cormac Flanagan,et al.  A type and effect system for atomicity , 2003, PLDI.

[15]  Armin Biere,et al.  Applying static analysis to large-scale, multi-threaded Java programs , 2001, Proceedings 2001 Australian Software Engineering Conference.

[16]  Andrew D. Birrell,et al.  Implementing Condition Variables with Semaphores , 2004 .

[17]  Alexander Aiken,et al.  Effective static race detection for Java , 2006, PLDI '06.

[18]  Patrice Godefroid,et al.  Partial-Order Methods for the Verification of Concurrent Systems , 1996, Lecture Notes in Computer Science.

[19]  Martín Abadi,et al.  Types for safe locking: Static race detection for Java , 2006, TOPL.

[20]  Gerard J. Holzmann,et al.  The SPIN Model Checker - primer and reference manual , 2003 .

[21]  David F. Bacon,et al.  Companion to the 22nd ACM SIGPLAN conference on Object-oriented programming systems and applications companion , 2007, OOPSLA 2007.

[22]  Arend Rensink,et al.  Graph Subsumption in Abstract State Space Exploration , 2012, GRAPHITE.

[23]  Matthew B. Dwyer,et al.  Using the Bandera Tool Set to Model-Check Properties of Concurrent Java Software , 2001, CONCUR.

[24]  J. David Morgenthaler,et al.  Using FindBugs on production software , 2007, OOPSLA '07.

[25]  Matthew Might,et al.  Improving flow analyses via ΓCFA: abstract garbage collection and counting , 2006, ICFP '06.

[26]  Herb Sutter,et al.  The Free Lunch Is Over A Fundamental Turn Toward Concurrency in Software , 2013 .

[27]  James C. Corbett,et al.  Bandera: extracting finite-state models from Java source code , 2000, ICSE.

[28]  H. Rice Classes of recursively enumerable sets and their decision problems , 1953 .

[29]  Matthew Might Abstract Interpreters for Free , 2010, SAS.

[30]  David Gay,et al.  Effective static deadlock detection , 2009, 2009 IEEE 31st International Conference on Software Engineering.

[31]  Stephen N. Freund,et al.  Type-based race detection for Java , 2000, PLDI '00.

[32]  Elvira Albert,et al.  Analysis of May-Happen-in-Parallel in Concurrent Objects , 2012, FMOODS/FORTE.

[33]  Patrick Cousot,et al.  Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints , 1977, POPL.

[34]  Martin C. Rinard,et al.  ACM Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA), November 2002 Ownership Types for Safe Programming: Preventing Data Races and Deadlocks , 2022 .

[35]  Lars-Åke Fredlund,et al.  McErlang: a model checker for a distributed functional programming language , 2007, ICFP '07.

[36]  Carl Hewitt,et al.  A Universal Modular ACTOR Formalism for Artificial Intelligence , 1973, IJCAI.

[37]  Matthew Might,et al.  A Family of Abstract Interpretations for Static Analysis of Concurrent Higher-Order Programs , 2011, SAS.

[38]  Amr Sabry,et al.  The essence of compiling with continuations , 1993, PLDI '93.

[39]  David Hovemeyer,et al.  Finding Concurrency Bugs in Java , 2004 .

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

[41]  Olin Shivers,et al.  Control-flow analysis of higher-order languages of taming lambda , 1991 .