Optimizing Solution Quality in Synchronization Synthesis

Given a multithreaded program written assuming a friendly, non-preemptive scheduler, the goal of synchronization synthesis is to automatically insert synchronization primitives to ensure that the modified program behaves correctly, even with a preemptive scheduler. In this work, we focus on the quality of the synthesized solution: we aim to infer synchronization placements that not only ensure correctness, but also meet some quantitative objectives such as optimal program performance on a given computing platform. The key step that enables solution optimization is the construction of a set of global constraints over synchronization placements such that each model of the constraints set corresponds to a correctness-ensuring synchronization placement. We extract the global constraints from generalizations of counterexample traces and the control-flow graph of the program. The global constraints enable us to choose from among the encoded synchronization solutions using an objective function. We consider two types of objective functions: ones that are solely dependent on the program (e.g., minimizing the size of critical sections) and ones that are also dependent on the computing platform. For the latter, given a program and a computing platform, we construct a performance model based on measuring average contention for critical sections and the average time taken to acquire and release a lock under a given average contention. We empirically evaluated that our approach scales to typical module sizes of many real world concurrent programs such as device drivers and multithreaded servers, and that the performance predictions match reality. To the best of our knowledge, this is the first comprehensive approach for optimizing the placement of synthesized synchronization.

[1]  Thomas A. Henzinger,et al.  Succinct Representation of Concurrent Trace Sets , 2015, POPL.

[2]  Armando Solar-Lezama,et al.  Sketching concurrent data structures , 2008, PLDI '08.

[3]  Leonid Ryzhyk,et al.  Regression-free Synthesis for Concurrency , 2014, CAV.

[4]  Bettina Könighofer,et al.  Synthesis of synchronization using uninterpreted functions , 2014, 2014 Formal Methods in Computer-Aided Design (FMCAD).

[5]  Giancarlo Mauri,et al.  Equivalence and Membership Problems for Regular Trace Languages , 1982, ICALP.

[6]  T. Henzinger,et al.  Quantitative Synthesis for Concurrent Programs , 2011, CAV.

[7]  Sumit Gulwani,et al.  Inferring locks for atomic sections , 2008, PLDI '08.

[8]  Leonid Ryzhyk,et al.  Efficient Synthesis for Concurrency by Semantics-Preserving Transformations , 2013, CAV.

[9]  Jyotirmoy V. Deshmukh,et al.  Logical Concurrency Control from Sequential Proofs , 2010, Log. Methods Comput. Sci..

[10]  Wei Zhang,et al.  Automated Concurrency-Bug Fixing , 2012, OSDI.

[11]  Daniel Kroening,et al.  Don’t Sit on the Fence , 2013, ACM Trans. Program. Lang. Syst..

[12]  Vivek Sarkar,et al.  Minimum Lock Assignment: A Method for Exploiting Concurrency among Critical Sections , 2008, LCPC.

[13]  Vivek Sarkar,et al.  Automatic Verification of Determinism for Structured Parallel Programs , 2010, SAS.

[14]  Frank Tip,et al.  Associating synchronization constraints with data in an object-oriented language , 2006, POPL '06.

[15]  Martin C. Rinard,et al.  Lock Coarsening: Eliminating Lock Overhead in Automatically Parallelized Object-Based Programs , 1996, LCPC.

[16]  Leonid Ryzhyk,et al.  From non-preemptive to preemptive scheduling using synchronization synthesis , 2015, CAV.

[17]  Martin C. Rinard,et al.  Lock Coarsening: Eliminating Lock Overhead in Automatically Parallelized Object-Based Programs , 1998, J. Parallel Distributed Comput..

[18]  Eran Yahav,et al.  Abstraction-guided synthesis of synchronization , 2010, POPL.

[19]  Rupak Majumdar,et al.  Lock allocation , 2007, POPL '07.

[20]  Yannis Smaragdakis,et al.  Adaptive Locks: Combining Transactions and Locks for Efficient Concurrency , 2009, 2009 18th International Conference on Parallel Architectures and Compilation Techniques.