This is an old revision of the document!
Back to 2014-proposals
Title: Creating safe multi-threaded applications in C++11
Proposer: Jos van Eijndhoven
Type: Tutorial
Duration: 45 mins
Description:
C++11 finally establishes the mechanisms and libraries to create portable multi-threaded applications. “Portable” meaning both to different OS environments as well as to different CPU platforms.
Multi-threaded behavior got properly defined through a set of rules that constrain the freedom of the compiler and runtime to reorder memory operations. Deterministic application behavior is guaranteed when data races cannot occur. Avoiding data races in terms of C11 semantics is a complex topic that deserves explanation regarding atomics and acquire-release barriers. The complexity of creating correct multi-threaded programs necessitates verification through tools. Unfortunately, the toolbox of the C++11 programmer is still rather rudimentary in this respect. Among a few threading race detector tools, Google's “thread sanitizer” is a highly promising public domain tool. It operates by building an order relationship among observed events, and can thereby report race conditions on program executions that otherwise would appear to behave fine. This model is a nice fit with the C++11 ordering semantics. A few interesting examples will be discussed.