Lock-free programming for real-time systems
summary
Claims that lock-free code using C++11 atomics and compare-exchange loops yields nonblocking progress for soft real-time systems, avoids deadlocks and priority inversion, and improves responsiveness. Demonstrates a working exchange buffer: a lock-free index pool plus storage, manual memory management, and a tagged index with ABA counter to prevent torn reads. Notes limits: types must be trivially copyable or require hazard-pointer–style reclamation, and correctness and memory-order tuning remain tricky.
AI-written summary · about
chapters (37)
- 0:00Introduction
- 0:38What are realtime systems
- 8:05Atomics
- 11:05Compare exchange
- 14:05Compare swap loop
- 17:03Motivations
- 19:05Functions
- 21:05Implementation
- 21:40Writing
- 23:32Not lockfree
- 24:18Managing our own memory
- 24:48Lockfree storage
- 26:05Logfree index pool
- 28:00How does it work
- 28:56Creating and repairing exchange buffer
- 31:00Implementing the right operation
- 35:50How does this work
- 37:45The real challenge
- 38:20What if we do it naively
- 39:00Bad things will happen
- 40:00Mitigation
- 40:50Checking if the data changes
- 42:18A smarter solution
- 43:33Counting
- 43:58AdaCounter
- 45:33Index
- 45:48Compact change
- 47:00Taking the data
- 49:34Dynamic memory
- 50:00Copy constructor
- 51:07Free garbage collection
- 51:50Memory order
- 52:50Summary
- 53:31Timeouts
- 55:43Queues
- 56:44Algorithms
- 58:25Disadvantages
related talks
01h 04mSingle Producer Single Consumer Lock-free FIFO From the Ground Up
01h 01mBack to Basics: C++ Concurrency
01h 33mThe Foundation of C++ Atomics: The Knowledge You Need to Correctly Use C++ Atomics
01h 02mLock-free Atomic Shared Pointers Without a Split Reference Count? It Can Be Done!
55mMemory Model: Get your shared data under control
01h 01mSmarter Cpp Atomic Smart Pointers - Efficient Concurrent Memory Management
01h 04mThe C++ Memory Model
01h 01mBuilding a Lock-free Multi-producer, Multi-consumer Queue for Tcmalloc
