Presenter: Hans Boehm, Association for Computing Machinery
Abstract: C++11 extended the language to include threads, defining a concurrency memory model to specify the semantics of shared variables, including "atomic" variables that can be accessed without mutual exclusion. Although this followed Posix threads by more than a decade, and the revision of the Java memory model by a few years, it still helped to resolve some very fundamental points of confusion about the semantics and validity of compiler optimizations in multi-threaded programs. The C definition largely copied it, and several other programming languages and systems, as well as later versions of Java, built on it.
These shared variable semantics provide a clean solution for concurrent programming for which a small amount of extra synchronization-related overhead is acceptable. However, C++ programmers pride themselves in squeezing out the last bit of performance, even if it involves living on the edge. Although the C++ memory model attempts to address those cases, issues remain. In particular, so-called "relaxed" atomics do not have clean semantics, for reasons that appear more and more fundamental. And the discovery that well-motivated hardware characteristics are incompatible with the original model required complicating it. On the other hand, hardware improvements have greatly reduced the need for the now deprecated "memory_order_consume" facility.
We'll start with an overview of the C++ memory model, and then outline some of the remaining challenges. We'll give an example to illustrate why "memory_order_relaxed", which attempts to just expose machine load and store instructions, is inherently much harder to define at the programming language level than it is at the hardware level.
Hosted by: Professor Mohsen Lesani
Location: Engineering 2, E2-180
*Refreshments such as coffee and pastries will be provided.