Repairing sequential consistency in C/C++11

Ori Lahav, Viktor Vafeiadis, Jeehoon Kang, Chung Kil Hur, Derek Dreyer

Research output: Contribution to journalArticlepeer-review

Abstract

The C/C++11 memory model defines the semantics of concurrent memory accesses in C/C++, and in particular supports racy "atomic" accesses at a range of different consistency levels, from very weak consistency ("relaxed") to strong, sequential consistency ("SC"). Unfortunately, as we observe in this paper, the semantics of SC atomic accesses in C/C++11, as well as in all proposed strengthenings of the semantics, is flawed, in that (contrary to previously published results) both suggested compilation schemes to the Power architecture are unsound. We propose a model, called RC11 (for Repaired C11), with a better semantics for SC accesses that restores the soundness of the compilation schemes to Power, maintains the DRF-SC guarantee, and provides stronger, more useful, guarantees to SC fences. In addition, we formally prove, for the first time, the correctness of the proposed stronger compilation schemes to Power that preserve load-to-store ordering and avoid "out-of-thin-air" reads.

Original languageEnglish
Pages (from-to)618-632
Number of pages15
JournalACM SIGPLAN Notices
Volume52
Issue number6
DOIs
StatePublished - 14 Jun 2017
Externally publishedYes

Keywords

  • C++11
  • Weak memory models
  • declarative semantics
  • sequential consistency

Fingerprint

Dive into the research topics of 'Repairing sequential consistency in C/C++11'. Together they form a unique fingerprint.

Cite this