Introduction
Explore the six memory model variants in C++ that define synchronization and ordering constraints for atomic operations. Learn how to apply these models to different atomic operations including reads, writes, and read-modify-writes, and understand their impact on concurrent programming behavior.
We'll cover the following...
You cannot configure the atomicity of an atomic data type, but you can accurately adjust the synchronization and ordering constraints of atomic operations. This possibility is unique to C++, as it’s not possible in C#'s or Java’s memory model.
There are six different variants of the memory model in C++. The key question is what are their characteristics?
Variants of the Memory Model
We already know C++ has six variants of the memory models. The default for atomic operations is std::memory_order_seq_cst; this expression stands for sequential consistency ...