Rely-Guarantee Termination and Cost Analyses of Loops with Concurrent Interleavings

By following a rely-guarantee style of reasoning, we present novel termination and cost analyses for concurrent programs that, in order to prove termination or infer the cost of a considered loop: (1) infer the termination/cost of each loop as if it were a sequential one, imposing assertions on how shared-data is modified concurrently; and then (2) prove that these assertions cannot be violated infinitely many times and, for cost analysis, infer how many times they are violated. At the core of the analysis, we use a may-happen-in-parallel analysis to restrict the set of program points whose execution can interleave. Interestingly, the same kind of reasoning can be applied to prove termination and infer upper bounds on the number of iterations of loops with concurrent interleavings. To the best of our knowledge, this is the first method to automatically bound the cost of such kind of loops. We have implemented our analysis for an actor-based language, and showed its accuracy and efficiency by applying it on several typical applications for concurrent programs and on an industrial case study.

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

[2]  Joe Armstrong,et al.  Concurrent programming in ERLANG , 1993 .

[3]  Reiner Hähnle,et al.  Resource Analysis of Complex Programs with Cost Equations , 2014, APLAS.

[4]  Andreas Podelski,et al.  Proving program termination , 2011, Commun. ACM.

[5]  Corporate New York Proceedings of the 16th ACM SIGPLAN-SIGACT symposium on Principles of programming languages , 1989, POPL 1989.

[6]  Elvira Albert,et al.  SYCO: a systematic testing tool for concurrent objects , 2016, CC.

[7]  Frank S. de Boer,et al.  A Complete Guide to the Future , 2007, ESOP.

[8]  Elvira Albert,et al.  Quantified abstract configurations of distributed systems , 2014, Formal Aspects of Computing.

[9]  Arnd Poetzsch-Heffter,et al.  JCoBox: Generalizing Active Objects to Concurrent Components , 2010, ECOOP.

[10]  Viktor Vafeiadis,et al.  Proving that non-blocking algorithms don't block , 2009, POPL '09.

[11]  Cosimo Laneve,et al.  Static analysis of cloud elasticity , 2015, PPDP.

[12]  Zhong Shao,et al.  Compositional certified resource bounds , 2015, PLDI.

[13]  Elvira Albert,et al.  Closed-Form Upper Bounds in Static Cost Analysis , 2011, Journal of Automated Reasoning.

[14]  Elvira Albert,et al.  Object‐sensitive cost analysis for concurrent objects , 2015, Softw. Test. Verification Reliab..

[15]  Sumit Gulwani,et al.  Bound Analysis of Imperative Programs with the Size-Change Abstraction , 2011, SAS.

[16]  Jürgen Giesl,et al.  Alternating Runtime and Size Complexity Analysis of Integer Programs , 2014, TACAS.

[17]  Stephen N. Freund,et al.  Thread-Modular Verification for Shared-Memory Programs , 2002, ESOP.

[18]  Helmut Veith,et al.  Difference constraints: an adequate abstraction for complexity analysis of imperative programs , 2015, 2015 Formal Methods in Computer-Aided Design (FMCAD).

[19]  Andrey Rybalchenko,et al.  Compositional Termination Proofs for Multi-threaded Programs , 2012, TACAS.

[20]  Elvira Albert,et al.  Cost Analysis of Concurrent OO Programs , 2011, APLAS.

[21]  Alan Mycroft,et al.  Kilim: Isolation-Typed Actors for Java , 2008, ECOOP.

[22]  Paul Feautrier,et al.  Multi-dimensional Rankings, Program Termination, and Complexity Bounds of Flowchart Programs , 2010, SAS.

[23]  Andreas Podelski,et al.  Proving thread termination , 2007, PLDI '07.

[24]  Elvira Albert,et al.  Combining Static Analysis and Testing for Deadlock Detection , 2016, IFM.

[25]  Gul A. Agha,et al.  ACTORS - a model of concurrent computation in distributed systems , 1985, MIT Press series in artificial intelligence.

[26]  Reiner Hähnle,et al.  ABS: A Core Language for Abstract Behavioral Specification , 2010, FMCO.

[27]  Martin Odersky,et al.  Scala Actors: Unifying thread-based and event-based programming , 2009, Theor. Comput. Sci..

[28]  Elvira Albert,et al.  Termination and Cost Analysis of Loops with Concurrent Interleavings , 2013, ATVA.

[29]  Elvira Albert,et al.  Non-cumulative Resource Analysis , 2015, TACAS.

[30]  Elvira Albert,et al.  A practical comparator of cost functions and its applications , 2015, Sci. Comput. Program..

[31]  Elvira Albert,et al.  May-Happen-in-Parallel Analysis for Asynchronous Programs with Inter-Procedural Synchronization , 2015, SAS.

[32]  Elvira Albert,et al.  SACO: Static Analyzer for Concurrent Objects , 2014, TACAS.

[33]  Bernd Finkbeiner,et al.  Causal Termination of Multi-threaded Programs , 2014, CAV.

[34]  Einar Broch Johnsen,et al.  Parallel Cost Analysis of Distributed Systems , 2015, SAS.

[35]  Anna Philippou,et al.  Tools and Algorithms for the Construction and Analysis of Systems , 2018, Lecture Notes in Computer Science.

[36]  Helmut Veith,et al.  A simple and scalable static analysis for bound analysis and amortized complexity analysis , 2014, Software Engineering.