Towards a Memory Model for C++

  • Hans Boehm | HP Laboratories

Many C and C++ programs use threads interfaces such as pthreads or the win32 threads API, either for program structuring, or to take advantage of multiprocessors. Although at least the pthreads specification gives fairly precise rules for accessing shared variables in this environment, it turns out that these are poorly understood by most programmers. Even when they are correctly understood, they are not quite sufficient to ensure reliability of multithreaded programs. These problems are known to generate occasional very puzzling failures in practice. They also make it even harder to teach programmers how to write multithreaded programs, a subject that is certainly already difficult enough. I will review what the rules are and explain when and why they are insufficient. I will give an overview of the ongoing effort (with Doug Lea, Bill Pugh, Peter Dimov, Clark Nelson, Alexander Terekhov, Andrei Alexandrescu, others, and, at least so far, the strong support of the C++ standards committee) to extend the C++ language specification to address these issues. I will briefly explain why the issues seem to be inherently different from languages such as Java and C#.

Although much of this is still a subject of active discussion, I will present highlights of the current, still informal, proposal. Even the uncontroversial aspects of this proposal will unavoidably have significant impact on code generation and optimization in C++ compilers.

Speaker Details

Hans-J. Boehm is the primary author of a widely used multithreaded garbage collector library. He was HPs representative to the recently completed effort to repair the Java “memory model”, and is driving an ongoing effort to extend the C++ standard with clean semantics for threads, and particularly shared variable accesses. He holds a Ph.D. from Cornell University, has published a number of influential papers on garbage collection, and a few on threads and synchronization. He is a past Chair of ACM SIGPLAN, and of the POPL, ISMM and VEE research symposia, and the winner of the 2006 SIGPLAN Distinguished Service Award. He works for HP Laboratories.

    • Portrait of Jeff Running

      Jeff Running