The C++ Memory Model
summary
Clear, example‑driven rundown of the C++11 memory model that states what is and isn’t guaranteed, shows compare_exchange push‑only lock‑free code that works and explains why pop is hard, and walks through memory_order_relaxed, acquire/release and sequentially‑consistent semantics with concrete failure modes (Dekker’s algorithm fails without SC) and compiler/ARM/Visual Studio pitfalls. Explanations include the observable effects, which atomic ops synchronize, when data races produce undefined behavior, and where performance and portability tradeoffs actually show up.
AI-written summary · about
chapters (9)
- 0:00Introduction
- 1:35Compiler optimizations
- 1:50Memory locations and races
- 7:23Historical examples
- 7:33Sequential consistency
- 8:18Interleaving operations
- 8:35Program order
- 8:54Guaranteeing consistency
- 9:04Advanced memory models
related talks
55mMemory Model: Get your shared data under control
01h 10mJava Memory Model (JMM) for Beginners and Advanced Users
01h 33mThe Foundation of C++ Atomics: The Knowledge You Need to Correctly Use C++ Atomics
44mDebugging memory corruptions in C++
01h 06mSecurity Beyond Memory Safety - Using Modern C++ to Avoid Vulnerabilities by Design
01h 02mLock-free programming for real-time systems
01h 02mModern C++ Safety and Security At 20
01h 01mBack to Basics: C++ Concurrency
