Shared variables and data races in C++11

  • Hans Boehm | HP Laboratories

C++11 and C11 added threads to the respective languages. In the process they gave much more precise semantics to shared variables. Like a number of earlier standards, but unlike Java, these languages give semantics only to programs without data races. Compared to those earlier standards, they are much clearer on what that means, and remove the motivation for nonetheless writing code with data races.

I will give an overview of the C++11 shared variable semantics or memory model, illustrate some of the subtleties around data races, and explain both why data race semantics were left undefined, and why, even in practice, it is never reasonable to rely on a C11 or C++11 program with data races. In particular, I will argue that programs with essentially all kinds of so-called “benign” data races are subject to future “miscompilation” by entirely reasonable compilers.

Speaker Details

Hans Boehm is a research manager at HP Labs.
He is probably best known as the primary author of a commonly used garbage collection library. Experiences with threads in that project eventually led him to initiate the effort to properly define threads and shared variables in C++11. He is an ACM Distinguished Scientist and a former Chair of ACM SIGPLAN.
He holds a B.S. degree from the University of Washington, and M.S. and Ph.D. degrees from Cornell University.

    • Portrait of Jeff Running

      Jeff Running

Series: Microsoft Research Talks