skip to main content
research-article

A promising semantics for relaxed-memory concurrency

Published:01 January 2017Publication History
Skip Abstract Section

Abstract

Despite many years of research, it has proven very difficult to develop a memory model for concurrent programming languages that adequately balances the conflicting desiderata of programmers, compilers, and hardware. In this paper, we propose the first relaxed memory model that (1) accounts for a broad spectrum of features from the C++11 concurrency model, (2) is implementable, in the sense that it provably validates many standard compiler optimizations and reorderings, as well as standard compilation schemes to x86-TSO and Power, (3) justifies simple invariant-based reasoning, thus demonstrating the absence of bad "out-of-thin-air" behaviors, (4) supports "DRF" guarantees, ensuring that programmers who use sufficient synchronization need not understand the full complexities of relaxed-memory semantics, and (5) defines the semantics of racy programs without relying on undefined behaviors, which is a prerequisite for applicability to type-safe languages like Java.

The key novel idea behind our model is the notion of *promises*: a thread may promise to execute a write in the future, thus enabling other threads to read from that write out of order. Crucially, to prevent out-of-thin-air behaviors, a promise step requires a thread-local certification that it will be possible to execute the promised write even in the absence of the promise. To establish confidence in our model, we have formalized most of our key results in Coq.

Skip Supplemental Material Section

Supplemental Material

References

  1. Coq development and supplementary material for this paper available at: http://sf.snu.ac.kr/promise-concurrency.Google ScholarGoogle Scholar
  2. LLVM documentation. LLVM atomic instructions and concurrency guide. http://llvm.org/docs/Atomics.html.Google ScholarGoogle Scholar
  3. JSR 133. Java memory model and thread specification revision, 2004. http://jcp.org/jsr/detail/133.jsp.Google ScholarGoogle Scholar
  4. Sarita V. Adve and Mark D. Hill. Weak ordering—A new definition. In Proc. 17th Annual International Symposium on Computer Architecture, ISCA 1990, pages 2–14. ACM, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Jade Alglave, Luc Maranget, and Michael Tautschnig. Herding cats: Modelling, simulation, testing, and data mining for weak memory. ACM Trans. Program. Lang. Syst., 36(2):7:1–7:74, July 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Mark Batty, Scott Owens, Susmit Sarkar, Peter Sewell, and Tjark Weber. Mathematizing C++ concurrency. In Proc. 38th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2011, pages 55–66. ACM, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Hans-Juergen Boehm and Brian Demsky. Outlawing ghosts: Avoiding out-of-thin-air results. In Proc. Workshop on Memory Systems Performance and Correctness, MSPC 2014, pages 7:1–7:6. ACM, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Soham Chakraborty and Viktor Vafeiadis. Formalizing the concurrency semantics of an LLVM fragment. In Proc. 15th IEEE/ACM International Symposium on Code Generation and Optimization, CGO 2017, 2017.Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Karl Crary and Michael J. Sullivan. A calculus for relaxed memory. In Proc. 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2015, pages 623–636. ACM, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Delphine Demange, Vincent Laporte, Lei Zhao, Suresh Jagannathan, David Pichardie, and Jan Vitek. Plan B: A buffered memory model for Java. In Proc. 40th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2013, pages 329–342. ACM, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Shaked Flur, Kathryn E. Gray, Christopher Pulte, Susmit Sarkar, Ali Sezgin, Luc Maranget, Will Deacon, and Peter Sewell. Modelling the ARMv8 architecture, operationally: Concurrency and ISA. In Proc. 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2016, pages 608–621. ACM, 2016. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. James Gosling, Bill Joy, and Guy Steele. The Java language specification, Edition 1.0, August 1996. http://titanium.cs.berkeley. edu/doc/java-langspec-1.0/. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. ISO/IEC 14882:2011. Programming language C++, 2011.Google ScholarGoogle Scholar
  14. Radha Jagadeesan, Corin Pitcher, and James Riely. Generative operational semantics for relaxed memory models. In ESOP, pages 307–326, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Alan Jeffrey and James Riely. On thin air reads: Towards an event structures model of relaxed memory. In Proc. IEEE Logic in Computer Science, LICS 2016, 2016. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Khronos Group. The OpenCL specification, Version 2.1, 2015.Google ScholarGoogle Scholar
  17. Ori Lahav, Nick Giannarakis, and Viktor Vafeiadis. Taming releaseacquire consistency. In Proc. 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2016, pages 649–662. ACM, 2016. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Ori Lahav and Viktor Vafeiadis. Explaining relaxed memory models with program transformations. In Proc. 21st International Symposium on Formal Methods, FM 2016, 2016.Google ScholarGoogle ScholarCross RefCross Ref
  19. Ori Lahav, Viktor Vafeiadis, Jeehoon Kang, Chung-Kil Hur, and Derek Dreyer. Repairing sequential consistency in C/C++11. Technical Report MPI-SWS-2016-011, MPI-SWS, November 2016.Google ScholarGoogle Scholar
  20. Andreas Lochbihler. Making the Java memory model safe. ACM Trans. Program. Lang. Syst., 35(4):12:1–12:65, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Jeremy Manson, William Pugh, and Sarita V. Adve. The Java memory model. In Proc. 32nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2005, pages 378–391. ACM, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Brian Norris and Brian Demsky. CDSchecker: Checking concurrent data structures written with C/C++ atomics. In Proc. 2013 ACM SIGPLAN International Conference on Object Oriented Programming Systems Languages & Applications, OOPSLA 2013, pages 131–150. ACM, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Scott Owens, Susmit Sarkar, and Peter Sewell. A better x86 memory model: x86-TSO. In Proc. 22nd International Conference on Theorem Proving in Higher Order Logics, TPHOLs 2009, pages 391–407. Springer, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Jean Pichon-Pharabod and Peter Sewell. A concurrency semantics for relaxed atomics that permits optimisation and avoids thin-air executions. In Proc. 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2016, pages 622–633. ACM, 2016. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Anton Podkopaev, Ilya Sergey, and Aleksandar Nanevski. Operational aspects of C/C++ concurrency. CoRR, abs/1606.01400, 2016.Google ScholarGoogle Scholar
  26. Jaroslav Ševˇcík and David Aspinall. On validity of program transformations in the Java memory model. In Proc. 22nd European Conference on Object-Oriented Programming, ECOOP 2008, volume 5142 of LNCS, pages 27–51. Springer, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Jaroslav Ševˇcík, Viktor Vafeiadis, Francesco Zappa Nardelli, Suresh Jagannathan, and Peter Sewell. CompCertTSO: A verified compiler for relaxed-memory concurrency. J. ACM, 60(3):22, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Viktor Vafeiadis, Thibaut Balabonski, Soham Chakraborty, Robin Morisset, and Francesco Zappa Nardelli. Common compiler optimisations are invalid in the C11 memory model and what we can do about it. In Proc. 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2015, pages 209–220. ACM, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Yang Zhang and Xinyu Feng. An operational happens-before memory model. Frontiers of Computer Science, 10(1):54–81, 2016. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A promising semantics for relaxed-memory concurrency

          Recommendations

          Comments

          Login options

          Check if you have access through your login credentials or your institution to get full access on this article.

          Sign in

          Full Access

          • Published in

            cover image ACM SIGPLAN Notices
            ACM SIGPLAN Notices  Volume 52, Issue 1
            POPL '17
            January 2017
            901 pages
            ISSN:0362-1340
            EISSN:1558-1160
            DOI:10.1145/3093333
            Issue’s Table of Contents
            • cover image ACM Conferences
              POPL '17: Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages
              January 2017
              901 pages
              ISBN:9781450346603
              DOI:10.1145/3009837

            Copyright © 2017 ACM

            Publisher

            Association for Computing Machinery

            New York, NY, United States

            Publication History

            • Published: 1 January 2017

            Check for updates

            Qualifiers

            • research-article

          PDF Format

          View or Download as a PDF file.

          PDF

          eReader

          View online with eReader.

          eReader
          About Cookies On This Site

          We use cookies to ensure that we give you the best experience on our website.

          Learn more

          Got it!