The Best of Both Worlds: Trading Efficiency and Optimality in Fence Insertion for TSO

We present a method for automatic fence insertion in concurrent programs running under weak memory models that provides the best known trade-off between efficiency and optimality. On the one hand, the method can efficiently handle complex aspects of program behaviors such as unbounded buffers and large numbers of processes. On the other hand, it is able to find small sets of fences needed for ensuring correctness of the program. To this end, we propose a novel notion of correctness, called persistence, that compares the behavior of the program under the weak memory semantics with that under the classical interleaving SC semantics. We instantiate our framework for the Total Store Ordering TSO memory model, and give an algorithm that reduces the fence insertion problem under TSO to the reachability problem for programs running under SC. Furthermore, we provide an abstraction scheme that substantially increases scalability to large numbers of processes. Based on our method, we have implemented a tool and run it successfully on a wide range benchmarks.

[1]  Francesco Zappa Nardelli,et al.  x86-TSO , 2010, Commun. ACM.

[2]  Sebastian Burckhardt,et al.  Effective Program Verification for Relaxed Memory Models , 2008, CAV.

[3]  Parosh Aziz Abdulla,et al.  Counter-Example Guided Fence Insertion under TSO , 2012, TACAS.

[4]  Koushik Sen,et al.  Sound and Complete Monitoring of Sequential Consistency for Relaxed Memory Models , 2011, TACAS.

[5]  Daniel Kroening,et al.  Software Verification for Weak Memory via Program Transformation , 2012, ESOP.

[6]  Mohamed Faouzi Atig,et al.  Getting Rid of Store-Buffers in TSO Analysis , 2011, CAV.

[7]  Dennis Shasha,et al.  Efficient and correct execution of parallel programs that share memory , 1988, TOPL.

[8]  Scott Owens,et al.  Reasoning about the Implementation of Concurrency Abstractions on x86-TSO , 2010, ECOOP.

[9]  Eran Yahav,et al.  Partial-coherence abstractions for relaxed memory models , 2011, PLDI '11.

[10]  Roland Meyer,et al.  Checking and Enforcing Robustness against TSO , 2013, ESOP.

[11]  Pierre Wolper,et al.  A Verification-Based Approach to Memory Fence Insertion in Relaxed Memory Systems , 2011, SPIN.

[12]  Todd Millstein,et al.  Simplified semantics and debugging of concurrent programs via targeted race detection , 2011 .

[13]  Daniel Kroening,et al.  Don't Sit on the Fence - A Static Analysis Approach to Automatic Fence Insertion , 2014, CAV.

[14]  Josep Torrellas,et al.  WeeFence: toward making fences free in TSO , 2013, ISCA.

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

[16]  Sebastian Burckhardt,et al.  The design of a task parallel library , 2009, OOPSLA.

[17]  Sarita V. Adve,et al.  Shared Memory Consistency Models: A Tutorial , 1996, Computer.

[18]  Jade Alglave,et al.  Stability in Weak Memory Models , 2011, CAV.

[19]  Feng Liu,et al.  Dynamic synthesis for relaxed memory models , 2012, PLDI.

[20]  Sebastian Burckhardt,et al.  On the verification problem for weak memory models , 2010, POPL '10.

[21]  Peter Sewell,et al.  A Better x86 Memory Model: x86-TSO , 2009, TPHOLs.

[22]  Anoop Gupta,et al.  Performance evaluation of memory consistency models for shared-memory multiprocessors , 1991, ASPLOS IV.

[23]  Maged M. Michael,et al.  Idempotent work stealing , 2009, PPoPP '09.

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

[25]  Pierre Wolper,et al.  A Verification-Based Approach to Memory Fence Insertion in PSO Memory Systems , 2013, TACAS.

[26]  Sebastian Burckhardt,et al.  What's Decidable about Weak Memory Models? , 2012, ESOP.

[27]  Eran Yahav,et al.  Automatic inference of memory fences , 2010, Formal Methods in Computer Aided Design.

[28]  Roland Meyer,et al.  Deciding Robustness against Total Store Ordering , 2011, ICALP.