The Two Memory Models
summary
Compares the C++ memory model to CPU models and shows concrete examples: making the ready flag an atomic with acquire/release turns the red (racy) arrows green so initialized data happens before use, while relaxed fails. Demonstrates GCC O3/14.1 emitted code differences: x86 needs no fences because of TSO (x86) store ordering, RISC‑V requires compiler-inserted fences or fence instructions. Explains store buffers, out-of-order execution, and when fences actually prevent reorders.
AI-written summary · about
chapters (9)
- 0:00Introduction
- 1:32Theoretical study
- 8:18Single-threaded reordering
- 19:38CPU and compiler constraints
- 28:44Happens-before in C++
- 32:31Atomic operations and ordering
- 43:06CPU memory models
- 55:26Relaxed models trade-offs
- 1:00:00Summary
related talks
01h 28mC++ Memory Model: from C++11 to C++23
01h 11mProgramming language memory models: Problems, solutions, and directions
30mA Tale of Shared Memory Concurrency in Programming Languages
01h 01m“C++11/14/17 atomics and memory model..."
59mA Relaxed Guide to memory_order_relaxed
21mWeak Memory Demands Model-based Compiler Testing
01h 33mC++11 to C++23 in the C++ Memory Model
40mA practical approach to Java Memory Model
