Lock-Free Programming (or, Juggling Razor Blades), Part I
summary
Concrete claims and usable patterns: uses std::atomic<T> and compare_exchange to publish complex structures with a single atomic handoff, fixes double-checked locking by making the instance pointer atomic, and shows a hybrid lock+atomic producer/consumer and a fully lock-free mail slots implementation. Explains progress categories (wait‑free, lock‑free, obstruction‑free), recommends measuring before/after, shows small optimizations (one-load Stefan trick), and supplies slides and code on the GitHub link.
AI-written summary · about
chapters (15)
- 0:00Introduction to lock-free
- 1:02Why use lock-free?
- 3:33Assumptions and tools
- 7:20Atomic foundations
- 10:07C++ atomic operations
- 12:40Atomic notes and levels
- 15:32Levels of lock-freedom
- 17:56Double-checked locking
- 24:12Locking optimizations
- 26:53Meyers singleton
- 30:31Combining locks and atomics
- 37:35Lock-free mail slots
- 39:37Mail slot implementation
- 46:04Consumer mail slot code
- 58:38Singly-linked list challenge
related talks
01h 02mA Lock-Free Atomic Shared Pointer in Modern Cpp
52mBest Practices for Concurrency
53mIntroduction to Lock-free Programming
01h 05mIntroduction to Wait-free Algorithms in C++ Programming
59mThreads and Locks must Go
01h 04mConcurrency TS2: Improved C++ Concurrency and Lock-free Programming
39mRust Atomics in the Wild: Memory Ordering Design Patterns [...]
59mMultithreading 101: Concurrency Primitives From Scratch
