Mathematizing C++ Concurrency

Mark Batty, Scott Owens, Susmit Sarkar, Peter Sewell, and Tjark Weber. In Thomas Ball and Mooly Sagiv, editors, Proceedings of the 38th ACM SIGPLAN-SIGACT Symposiumon Principles of Programming Languages, POPL 2011, Austin, TX, USA, January 26-28, 2011, pages 55-66. ACM, 2011.

Abstract

Shared-memory concurrency in C and C++ is pervasive in systems programming, but has long been poorly defined. This motivated an ongoing shared effort by the standards committees to specify concurrent behaviour in the next versions of both languages. They aim to provide strong guarantees for race-free programs, together with new (but subtle) relaxed-memory atomic primitives for high-performance concurrent code. However, the current draft standards, while the result of careful deliberation, are not yet clear and rigorous definitions, and harbour substantial problems in their details.

In this paper we establish a mathematical (yet readable) semantics for C++ concurrency. We aim to capture the intent of the current (`Final Committee') Draft as closely as possible, but discuss changes that fix many of its problems. We prove that a proposed x86 implementation of the concurrency primitives is correct with respect to the x86-TSO model, and describe our Cppmem tool for exploring the semantics of examples, using code generated from our Isabelle/HOL definitions.

Having already motivated changes to the draft standard, this work will aid discussion of any further changes, provide a correctness condition for compilers, and give a much-needed basis for analysis and verification of concurrent C and C++ programs.

Download

BibTeX

@inproceedings{batty11mathematizing,
  author    = {Mark Batty and Scott Owens and Susmit Sarkar and Peter Sewell and Tjark Weber},
  title     = {Mathematizing {C++} Concurrency},
  editor    = {Thomas Ball and Mooly Sagiv},
  booktitle = {Proceedings of the 38th ACM SIGPLAN-SIGACT Symposium on
               Principles of Programming Languages, POPL 2011, Austin,
               TX, USA, January~26-28, 2011},
  pages     = {55--66},
  publisher = {ACM},
  year      = {2011},
  url       = {http://doi.acm.org/10.1145/1926385.1926394}
}

Last modified: 2011-02-06