The foundation of C++20 atomics: The knowledge you need to correctly use C++20 atomics.

Speaker: Filipe Mulonde

Audience level: Intermediate | Advanced

This talk covers all the necessary knowledge about atomics that you need to know to get a good understanding of how atomics work under the hood and make sure your code is correct.

In 2011, C++11 introduced atomics whit 6 memory orders and atomics have been improved in C++20, but writing correct concurrent programs that use atomics is not an easy task and this task requires the programmer to have a considerable understanding of the complexity of how atomic works under the hood, and the lack of that understanding brings a lack of confidence in many C++ programmers to use atomics. The goal of this talk is to help programmers use atomic correctly, gain more confidence, and make them feel comfortable using atomic.

I hope this talk can help programmers to use atomic correctly and increase their confidence and comfort using atomic by bringing knowledge of some of the main components that make parallelism possible in modern computer systems, the relationship between these components and the individual contribution of each of these components in making atomic difficult to use correctly.

Topics Covered: the C++ 20 parallel memory model in relation to atomics, optimizations Allowed by the memory model,the Cost of Sequentially Consistent Atomics,Semantics of Data Races,Compiler and Hardware introduced Data Races, static & dynamic Instruction Scheduling, Multi-core processors,Operating system context switching,memory Barriers,Memory Consistency and Cache Coherence, the compiler and hardware cooperation to respect the memory model, the relationships and tradeoffs among atomics and fences/barriers and how atomic map to their expected machine-instruction implementations on x86 architecture .

If you think you know C++ atomics but are unclear on few details, come to fill these few gaps in your knowledge. If you really do know C++ atomics, come because you might be surprised.