Clarifying and compiling C/C++ concurrency

Author:

Batty Mark1,Memarian Kayvan2,Owens Scott1,Sarkar Susmit1,Sewell Peter1

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

同舟云学术

1.学者识别学者识别

2.学术分析学术分析

3.人才评估人才评估

"同舟云学术"是以全球学者为主线,采集、加工和组织学术论文而形成的新型学术文献查询和分析系统,可以对全球学者进行文献检索和人才价值评估。用户可以通过关注某些学科领域的顶尖人物而持续追踪该领域的学科进展和研究前沿。经过近期的数据扩容,当前同舟云学术共收录了国内外主流学术期刊6万余种,收集的期刊论文及会议论文总量共计约1.5亿篇,并以每天添加12000余篇中外论文的速度递增。我们也可以为用户提供个性化、定制化的学者数据。欢迎来电咨询!咨询电话:010-8811{复制后删除}0370

www.globalauthorid.com

TOP

Copyright © 2019-2024 北京同舟云网络信息技术有限公司
京公网安备11010802033243号  京ICP备18003416号-3