Formalizing and Checking Thread Refinement for Data-Race-Free Execution Models

  • Daniel PoetzlEmail author
  • Daniel Kroening
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9636)


When optimizing a thread in a concurrent program (either done manually or by the compiler), it must be guaranteed that the resulting thread is a refinement of the original thread. Most definitions of refinement are formulated in terms of valid syntactic transformations on the program code, or in terms of valid transformations on thread execution traces. We present a new theory formulated instead in terms of state transitions between synchronization operations. Our new method shows refinement in more cases and leads to more efficient and simpler procedures for refinement checking. We develop the theory for the SC-for-DRF execution model (using locks for synchronization), and show that its application in compiler testing yields speedups of on average more than two orders of magnitude compared to a previous approach.


Memory Location Critical Section State Trace Data Race Sequentially Consistent 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


  1. 1.
    Adve, S.V., Hill, M.D.: Weak ordering - a new definition. In: International Symposium on Computer Architecture (ISCA), pp. 2–14. ACM (1990)Google Scholar
  2. 2.
    Boehm, H.-J.: Reordering constraints for Pthread-style locks. In: Principles and Practice of Parallel Programming (PPoPP), pp. 173–182. ACM (2007)Google Scholar
  3. 3.
    Brookes, S.: Full abstraction for a shared variable parallel language. In: Logic in Computer Science (LICS), pp. 98–109. IEEE (1993)Google Scholar
  4. 4.
    Eide, E., Regehr, J.: Volatiles are miscompiled, and what to do about it. In: Embedded Software (EMSOFT), pp. 255–264. ACM (2008)Google Scholar
  5. 5.
    Jagadeesan, R., Petri, G., Riely, J.: Brookes is relaxed, almost!. In: Birkedal, L. (ed.) FOSSACS 2012. LNCS, vol. 7213, pp. 180–194. Springer, Heidelberg (2012)CrossRefGoogle Scholar
  6. 6.
    Lamport, L.: How to make a multiprocessor computer that correctly executes multiprocess programs. TC 100(9), 690–691 (1979)zbMATHGoogle Scholar
  7. 7.
    Liang, H., Feng, X., Fu, M.: A rely-guarantee-based simulation for verifying concurrent program transformations. In: Principles of Programming Languages (POPL), pp. 455–468. ACM (2012)Google Scholar
  8. 8.
    Liang, H., Feng, X., Shao, Z.: Compositional verification of termination-preserving refinement of concurrent programs. In: Logic in Computer Science (LICS), pp. 65:1–65:10. ACM (2014)Google Scholar
  9. 9.
    Lochbihler, A.: Verifying a compiler for Java threads. In: Gordon, A.D. (ed.) ESOP 2010. LNCS, vol. 6012, pp. 427–447. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  10. 10.
    Luk, C.-K., Cohn, R., Muth, R., Patil, H., Klauser, A., Lowney, G., Wallace, S., Reddi, V.J., Hazelwood, K.: Pin: Building customized program analysis tools with dynamic instrumentation. In: Programming Language Design and Implementation (PLDI), pp. 190–200. ACM (2005)Google Scholar
  11. 11.
    Manson, J., Pugh, W., Adve, S.V.: The Java memory model. In: Principles of Programming Languages (POPL), pp. 378–391. ACM (2005)Google Scholar
  12. 12.
    Morisset, R., Pawan, P., Nardelli, F.Z.: Compiler testing via a theory of sound optimisations in the C11/C++11 memory model. In: Programming Language Design and Implementation (PLDI), pp. 187–196. ACM (2013)Google Scholar
  13. 13.
    Poetzl, D., Kroening, D.: Formalizing and checking thread refinement for data-race-free execution models (extended version) (2015). CoRR, abs/1505.08581Google Scholar
  14. 14.
    Ševčík, J.: Safe optimisations for shared-memory concurrent programs. In: Programming Language Design and Implementation (PLDI), pp. 306–316. ACM (2011)Google Scholar
  15. 15.
    Ševčík, J., Aspinall, D.: On validity of program transformations in the Java memory model. In: Vitek, J. (ed.) ECOOP 2008. LNCS, vol. 5142, pp. 27–51. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  16. 16.
    Ševčík, J., Vafeiadis, V., Nardelli, F.Z., Jagannathan, S., Sewell, P.: CompCertTSO: A verified compiler for relaxed-memory concurrency. JACM 60(3), 49 (2013)MathSciNetzbMATHGoogle Scholar
  17. 17.
    X. Yang, Y. Chen, E. Eide, and J. Regehr. Finding and understanding bugs in C compilers. In Programming Language Design and Implementation (PLDI), pp. 283–294. ACM, (2011)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2016

Authors and Affiliations

  1. 1.University of OxfordOxfordUK

Personalised recommendations