This lesson introduces the concepts of synchronization and ordering constraints in C++.

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. In addition, you can explicitly specify one of the other five. So what does C++ have to offer?

Get hands-on with 1000+ tech skills courses.