Lock-free Programming is Dead - Long Live Lock-free Programming!
summary
Extensive CPU benchmarks on Intel, AMD, ARM and Apple silicon show spinlocks beat atomics under high contention—often improving whole-program throughput by ~2–2.5×—because contended atomics flood coherence traffic and cause backend/store-buffer stalls. For rare updates atomics win at low contention with minimal pipeline disruption. A hybrid MPMC ring (spinlocked head/tail, per-slot atomics, reserved-value handling) is implemented and proves faster overall but suffers worse tail latency because locks are preemptible. Key techniques: pre-read (multiple reads) plus aggressive backoff to avoid RFO storms; separate lock and data cache lines often helps.
AI-written summary · about
chapters (10)
- 0:00Introduction
- 12:54Lock-free vs lock-based
- 23:28Spin locks vs atomics
- 31:24Hidden costs of locks
- 41:00Benchmarking locks vs lock-free
- 55:28Hybrid data structure design
- 1:06:51Latency vs throughput trade-offs
- 1:13:53Lock-free role today
- 1:23:53Key takeaways
- 1:35:42Q&A
related talks
01h 12mThe speed of concurrency (is lock-free faster?)
01h 14m“C++ atomics, from basic to advanced. What do they really do?”
01h 30mLive Lock-Free or Deadlock (Practical Lock-free Programming)
39mLive Lock-Free or Deadlock (Practical Lock-free Programming)
48m“Is Parallel Programming still hard? PART 2 of 2”
01h 22mBeyond Sequential Consistency - Leveraging Atomics for Fun & Profit
01h 11mLock-Free Programming (or, Juggling Razor Blades), Part II
01h 32mLock-free programming with modern C++
