Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/3009837.3009850acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
research-article

A promising semantics for relaxed-memory concurrency

Published: 01 January 2017 Publication History

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.

Supplementary Material

Auxiliary Archive (p175-kang-s.zip)
Coq formalization. See https://github.com/snu-sf/promising-coq for the latest version.

References

[1]
Coq development and supplementary material for this paper available at: http://sf.snu.ac.kr/promise-concurrency.
[2]
LLVM documentation. LLVM atomic instructions and concurrency guide. http://llvm.org/docs/Atomics.html.
[3]
JSR 133. Java memory model and thread specification revision, 2004. http://jcp.org/jsr/detail/133.jsp.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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/.
[13]
ISO/IEC 14882:2011. Programming language C++, 2011.
[14]
Radha Jagadeesan, Corin Pitcher, and James Riely. Generative operational semantics for relaxed memory models. In ESOP, pages 307–326, 2010.
[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.
[16]
Khronos Group. The OpenCL specification, Version 2.1, 2015.
[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.
[18]
Ori Lahav and Viktor Vafeiadis. Explaining relaxed memory models with program transformations. In Proc. 21st International Symposium on Formal Methods, FM 2016, 2016.
[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.
[20]
Andreas Lochbihler. Making the Java memory model safe. ACM Trans. Program. Lang. Syst., 35(4):12:1–12:65, 2014.
[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.
[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.
[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.
[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.
[25]
Anton Podkopaev, Ilya Sergey, and Aleksandar Nanevski. Operational aspects of C/C++ concurrency. CoRR, abs/1606.01400, 2016.
[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.
[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.
[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.
[29]
Yang Zhang and Xinyu Feng. An operational happens-before memory model. Frontiers of Computer Science, 10(1):54–81, 2016.

Cited By

View all
  • (2025)Monadic Interpreters for Concurrent Memory ModelsProceedings of the 14th ACM SIGPLAN International Conference on Certified Programs and Proofs10.1145/3703595.3705890(283-298)Online publication date: 10-Jan-2025
  • (2025)Formalisation of a New Weak Semantics for AuDaLaAutomated Technology for Verification and Analysis10.1007/978-3-031-78750-8_5(93-116)Online publication date: 12-Feb-2025
  • (2024)CrossMappingProceedings of the 2024 USENIX Conference on Usenix Annual Technical Conference10.5555/3691992.3692054(1013-1028)Online publication date: 10-Jul-2024
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

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
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

In-Cooperation

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 01 January 2017

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. C++11
  2. Weak memory models
  3. operational semantics

Qualifiers

  • Research-article

Funding Sources

  • Samsung Research Funding Center
  • ERC Consolidator

Conference

POPL '17
Sponsor:

Acceptance Rates

Overall Acceptance Rate 860 of 4,328 submissions, 20%

Upcoming Conference

POPL '26

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)127
  • Downloads (Last 6 weeks)15
Reflects downloads up to 10 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2025)Monadic Interpreters for Concurrent Memory ModelsProceedings of the 14th ACM SIGPLAN International Conference on Certified Programs and Proofs10.1145/3703595.3705890(283-298)Online publication date: 10-Jan-2025
  • (2025)Formalisation of a New Weak Semantics for AuDaLaAutomated Technology for Verification and Analysis10.1007/978-3-031-78750-8_5(93-116)Online publication date: 12-Feb-2025
  • (2024)CrossMappingProceedings of the 2024 USENIX Conference on Usenix Annual Technical Conference10.5555/3691992.3692054(1013-1028)Online publication date: 10-Jul-2024
  • (2024)Automated Robustness Verification of Concurrent Data Structure Libraries against Relaxed Memory ModelsProceedings of the ACM on Programming Languages10.1145/36898028:OOPSLA2(2578-2605)Online publication date: 8-Oct-2024
  • (2024)A Two-Phase Infinite/Finite Low-Level Memory Model: Reconciling Integer–Pointer Casts, Finite Space, and undef at the LLVM IR Level of AbstractionProceedings of the ACM on Programming Languages10.1145/36746528:ICFP(789-817)Online publication date: 15-Aug-2024
  • (2024)Fully Composable and Adequate Verified Compilation with Direct Refinements between Open ModulesProceedings of the ACM on Programming Languages10.1145/36329148:POPL(2160-2190)Online publication date: 5-Jan-2024
  • (2024)An Axiomatic Basis for Computer Programming on the Relaxed Arm-A Architecture: The AxSL LogicProceedings of the ACM on Programming Languages10.1145/36328638:POPL(604-637)Online publication date: 5-Jan-2024
  • (2024)Unifying Weak Memory Verification Using PotentialsFormal Methods10.1007/978-3-031-71162-6_27(519-537)Online publication date: 9-Sep-2024
  • (2024)Practical Rely/Guarantee Verification of an Efficient Lock for seL4 on Multicore ArchitecturesThe Practice of Formal Methods10.1007/978-3-031-66676-6_4(65-87)Online publication date: 4-Sep-2024
  • (2024)Modelling and Verifying Programs Under the Total Store Order Memory Model in an Algebraic Semantics StyleThe Practice of Formal Methods10.1007/978-3-031-66673-5_11(206-225)Online publication date: 4-Sep-2024
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media