An explanation of weak memory concurrency and why multi-threaded programs can produce counterintuitive results on modern hardware. Starting from Leslie Lamport's sequential consistency model, the video demonstrates that the 'impossible' outcome of two threads both reading zero is actually observable in C++. Two root causes are explored: compiler instruction reordering and hardware store buffers (particularly on x86). The concept of multi-copy atomicity is introduced, showing that x86 guarantees it while IBM Power does not. The discussion uses a classical vs. quantum physics analogy to explain why higher-level developers are often shielded from these weak behaviors, while low-level programmers in C, C++, or Rust must account for them.

16m watch time

Sort: