Foundations of the C++ concurrency memory model

Hans J. Boehm, Sarita V. Adve

Research output: Chapter in Book/Report/Conference proceedingConference contribution

Abstract

Currently multi-threaded C or C++ programs combine a single-threaded programming language with a separate threads library. This is not entirely sound [7]. We describe an effort, currently nearing completion, to address these issues by explicitly providing semantics for threads in the next revision of the C++ standard. Our approach is similar to that recently followed by Java [25], in that, at least for a well-defined and interesting subset of the language, we give sequentially consistent semantics to programs that do not contain data races. Nonetheless, a number of our decisions are often surprising even to those familiar with the Java effort: • We (mostly) insist on sequential consistency for race-free programs, in spite of implementation issues that came to light after the Java work. • We give no semantics to programs with data races. There are no benign C++ data races. • We use weaker semantics for trylock than existing languages or libraries, allowing us to promise sequential consistency with an intuitive race definition, even for programs with trylock. This paper describes the simple model we would like to be able to provide for C++ threads programmers, and explain how this, together with some practical, but often under-appreciated implementation constraints, drives us towards the above decisions.

Original languageEnglish (US)
Title of host publicationPLDI'08
Subtitle of host publicationProceedings of the 2008 SIGPLAN Conference on Programming Language Design and Implementation
Pages68-78
Number of pages11
DOIs
StatePublished - 2008
Event2008 ACM SIGPLAN Conference on Programming Language Design and Implementation 2008, PLDI'08 - Tucson, AZ, United States
Duration: Jun 7 2007Jun 13 2007

Publication series

NameProceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI)

Conference

Conference2008 ACM SIGPLAN Conference on Programming Language Design and Implementation 2008, PLDI'08
Country/TerritoryUnited States
CityTucson, AZ
Period6/7/076/13/07

Keywords

  • C++
  • Data race
  • Memory consistency
  • Memory model
  • Sequential consistency
  • Trylock

ASJC Scopus subject areas

  • Software

Fingerprint

Dive into the research topics of 'Foundations of the C++ concurrency memory model'. Together they form a unique fingerprint.

Cite this