Chapter 5. The C++ memory model and operations on atomic types
This chapter covers
- The details of the C++ memory model
- The atomic types provided by the C++
- Standard Library
- The operations that are available on those types
- How those operations can be used to provide synchronization between threads
One of the most important features of the C++ Standard is something most programmers won’t even notice. It’s not the new syntax features, nor is it the new library facilities, but the new multithreading-aware memory model. Without the memory model to define exactly how the fundamental building blocks work, none of the facilities I’ve covered could be relied on to work. There’s a reason that most programmers won’t notice: if you use mutexes to protect your data and condition variables, futures, latches, or barriers to signal events, the details of why they work aren’t important. It’s only when you start trying to get “close to the machine” that the precise details of the memory model matter.