C++ Memory Model: from C++11 to C++23
summary
Shows exactly what the standard actually gives and what breaks: compilers hoist, fold and vectorize code; CPUs do out‑of‑order execution and caching; a demo where a relaxed atomic version lets corrupt updates pass but switching to acquire/release (or a full fence) fixes it. Highlights that volatile is not synchronization, 32‑bit/ARM/RISC-V volatile loads split and aren’t atomic, and most compilers treat consume as acquire. Walks through spinlock, compare_exchange strong vs weak, atomic_shared_ptr (C++20), JThread/stop_token, semaphores, latches and barriers, with assembly proofs of what actually runs.
AI-written summary · about
chapters (13)
- 0:00Introduction and speaker intro
- 3:19Compiler optimizations explained
- 17:56CPU execution models overview
- 26:47C++ memory reordering rules
- 31:02Sequential consistency and data races
- 34:56Volatile is not synchronization
- 39:30Memory ordering semantics deep dive
- 48:50Consume semantics and dependencies
- 51:06C++ threading tools overview
- 1:01:28Atomic operations and memory fences
- 1:10:51C++20 concurrency features
- 1:23:17C++11 statics and once flags
- 1:25:07Q&A session
related talks
01h 33mC++11 to C++23 in the C++ Memory Model
01h 01m“C++11/14/17 atomics and memory model..."
01h 02mThe Two Memory Models
51mMemory Model: Get your shared data under control
42mThe C++ Execution Model
43mC++ Atomics...
01h 11mProgramming language memory models: Problems, solutions, and directions
01h 00mConcurrency Improvements in C++20: A Deep Dive
