The speed of concurrency (is lock-free faster?)
summary
Benchmarks use Google benchmark and microtests of atomic increment, mutex, compare-and-swap loops and queue/list implementations on machines up to 120 hardware threads, showing mutexes often lose, CAS is better, atomic fetch_add fastest for simple counters, but surprisingly a homemade spin lock beats lock-free pointer swap in many cases. Tests report throughput, CPU-time and tail-latency (90/95%) and expose the ABA problem in lock-free lists; solutions include intrusive atomic shared pointers, hazard pointers, and copying work outside small critical sections.
AI-written summary · about
chapters (18)
- 0:00Introduction to lock-free
- 2:25Performance measurement rules
- 3:51Concurrent program performance
- 6:36Cost of data sharing
- 10:11Synchronization mechanisms
- 11:59Atomic vs mutex vs lock-free
- 17:45Benchmarking on different systems
- 20:19Thread-safe data structures
- 24:38ABA problem in lock-free lists
- 27:56Atomic shared pointers
- 31:31Thread-safe forward list
- 35:26Lock-free queue basics
- 40:26Benchmarking queue special cases
- 45:28Spin lock vs lock-free queue
- 49:48Overhead of synchronization
- 54:14RCU and memory reclamation
- 54:57When to use lock-free
- 57:26Summary and Q&A
related talks
01h 14m“C++ atomics, from basic to advanced. What do they really do?”
01h 38mLock-free Programming is Dead - Long Live Lock-free Programming!
52mNonblocking algorithms/ CAS/Atomics
43mWhen Atomics Lose - Architecture‑Dependent Performance of C++ Synchronization
01h 00mConcurrency in C++20: A Deep Dive
01h 30mLive Lock-Free or Deadlock (Practical Lock-free Programming)
48m“Is Parallel Programming still hard? PART 2 of 2”
50mThe Hidden Art of Thread-Safe Programming: Exploring java.util.con...
