Affiliation:
1. University of Cambridge, Cambridge, United Kingdom
2. University of Cambridge & INRIA, Cambridge, United Kingdom
Abstract
The upcoming C and C++ revised standards add concurrency to the languages, for the first time, in the form of a subtle *relaxed memory model* (the *C++11 model*). This aims to permit compiler optimisation and to accommodate the differing relaxed-memory behaviours of mainstream multiprocessors, combining simple semantics for most code with high-performance *low-level atomics* for concurrency libraries. In this paper, we first establish two simpler but provably equivalent models for C++11, one for the full language and another for the subset without consume operations. Subsetting further to the fragment without low-level atomics, we identify a subtlety arising from atomic initialisation and prove that, under an additional condition, the model is equivalent to sequential consistency for race-free programs.
We then prove our main result, the correctness of two proposed compilation schemes for the C++11 load and store concurrency primitives to Power assembly, having noted that an earlier proposal was flawed. (The main ideas apply also to ARM, which has a similar relaxed memory architecture.)
This should inform the ongoing development of production compilers for C++11 and C1x, clarifies what properties of the machine architecture are required, and builds confidence in the C++11 and Power semantics.
Publisher
Association for Computing Machinery (ACM)
Subject
Computer Graphics and Computer-Aided Design,Software
Reference25 articles.
1. The power of processor consistency
2. Weak ordering---a new definition
3. J. Alglave. A Shared Memory Poetics. PhD thesis Université Paris 7 and INRIA 2010. J. Alglave. A Shared Memory Poetics. PhD thesis Université Paris 7 and INRIA 2010.
4. Fences in Weak Memory Models
Cited by
25 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Hawkeyes: Addressing Weak Memory Order in Program Migration Based on Instruction Windows;Proceedings of the 4th Workshop on Challenges and Opportunities of Efficient and Performant Storage Systems;2024-04-22
2. CAAT: consistency as a theory;Proceedings of the ACM on Programming Languages;2022-10-31
3. Lasagne: a static binary translator for weak memory model architectures;Proceedings of the 43rd ACM SIGPLAN International Conference on Programming Language Design and Implementation;2022-06-09
4. High‐coverage metamorphic testing of concurrency support in C compilers;Software Testing, Verification and Reliability;2022-03-22
5. A Survey of Programming Language Memory Models;Programming and Computer Software;2021-11