Search⌘ K
AI Features

The Contract

Learn how the C++ memory model creates a contract between the programmer and system, defining rules for multithreading correctness and optimization. This lesson explains the evolution of the memory model from pre-C++11 to its current levels, helping you understand key concepts like sequence points, data races, and atomic operations for safe concurrent programming.

We'll cover the following...

The foundation of multithreading is a well-defined memory model. From the reader’s perspective, it consists of two aspects. First, there is the enormous complexity of it, which often contradicts our intuition. Second, it helps to get a deeper insight into the multithreading challenges. In the first approach, we want to give you a mental model. That being said, the C++ memory model defines a contract.

The Contract

This contract exists between the programmer and the system. The system ...