Lock-free Atomic Shared Pointers Without a Split Reference Count? It Can Be Done!
Talkat CppCon 2023 · on Tuesday, 2023-10-03· at 14:00· Maple 3/4/5, 6700 North Gaylord Rockies Boulevard·
summary
Claim: implement lock-free atomic shared pointers without a split reference count by replacing delete with hazard pointers and deferred reclamation. Repository and slide code exist; implementation is nearly-standard C++ and uses standard shared_ptr increment-if-not-zero. Benchmarks show the hazard-pointer version wins when data is hot in cache, Folly wins on cold/cross-socket access, and major stdlibs currently provide non-lock-free atomic shared_ptrs, so this alternative is practical and performant.
AI-written summary · about
chapters (21)
- 0:00Introduction
- 1:06Atomic shared pointers
- 3:54Lock-free algorithms
- 5:18Shared pointers memory
- 8:52Thread safety issues
- 9:53Benefits of atomic shared pointers
- 11:42Hard to implement lock-free
- 15:34Split reference count
- 18:26Split reference counting
- 20:08Load operation pseudocode
- 23:18Store operation race-to-zero
- 26:3116-byte atomics implementation
- 29:42Limitations of split reference count
- 31:50Deferred reclamation primer
- 35:28Atomic shared pointers with deferred reclamation
- 38:39Load operation with hazard pointers
- 41:51Store operation and retirement
- 44:40Hazard pointer simplicity
- 45:25Benchmarking concurrent stacks
- 55:10Implementation and future work
- 56:35Q&A
related talks
01h 01mSmarter Cpp Atomic Smart Pointers - Efficient Concurrent Memory Management
01h 02mLock-free programming for real-time systems
17mFat Pointers for Temporal Memory Safety of C
54mHazard Pointer Synchronous Reclamation Beyond Concurrency TS2
01h 02mModern C++ Safety and Security At 20
39mSafety first
01h 26mA Path to Practically Safe C++
55mMemory Model: Get your shared data under control
