Memory Model: Get your shared data under control
summary
Covers C++20 memory model with concrete examples that build a hikers-and-lighthouse story to show when each primitive is appropriate: latch for one‑time joins, barrier for reusable rendezvous, semaphores for limited capacity, mutex/lock_guard/unique_lock/shared_mutex patterns, condition_variable semantics, and a deep dive into atomics (fetch_/exchange/compare_exchange_strong/weak, wait/notify, atomic_ref, atomic_shared_ptr). Warns that atomics avoid deadlocks but require loops for weak CAS, overloaded += is a race trap, and synchronization disables compiler/CPU reorderings so use the simplest tool that works.
AI-written summary · about
chapters (14)
- 0:00Memory model basics
- 1:48Shared data reordering
- 7:32Synchronization primitives and their necessity
- 12:11Safe memory access
- 13:18Latches for sync
- 14:41Mutexes explained
- 19:41Barriers for sync
- 24:00Semaphores for access
- 27:55Condition variables
- 31:53Atomics vs sync
- 37:17Atomic pitfalls
- 43:08Compare-exchange strong vs weak
- 45:21Atomic references
- 48:55Summary of atomics
related talks
01h 28mC++ Memory Model: from C++11 to C++23
01h 03mSafety: off --- How not to shoot yourself in the foot with C++ atomics
30mA Tale of Shared Memory Concurrency in Programming Languages
01h 01m“C++11/14/17 atomics and memory model..."
01h 00mConcurrency in C++20: A Deep Dive
01h 00mConcurrency Improvements in C++20: A Deep Dive
01h 33mC++11 to C++23 in the C++ Memory Model
01h 11mLock-Free Programming (or, Juggling Razor Blades), Part II
