Building Robust Inter-Process Queues in C++
summary
Examines two popular SPSC queues (Daugaard, Rigtorp) and shows that simply mmap-ing them breaks: std::atomic is not an implicit-lifetime type in C++20, placement-newed objects and internal pointers require explicit reinitialization, and user-defined constructors make shared-memory instances undefined. Proposes a separated design: a metadata-backed queue that enforces single-producer/single-consumer ownership, reattach reader/writer pointers on process attach, and a robust process lock using PID+start-time plus an optional MCAST special-consumer for non-blocking broadcasts.
AI-written summary · about
chapters (10)
- 0:00Introduction
- 5:01Inter-process queues requirements
- 10:27Dow Guard ring buffer
- 21:44Cross-process queue challenges
- 33:36Undefined behavior in queues
- 44:12C++20 lifetime types
- 52:39Cache line alignment
- 54:07Separation of concerns
- 1:01:17MCAST queues production
- 1:06:15Q&A
related talks
01h 08mThinking Outside the Synchronisation Quadrant
01h 05mAn Interesting Lock-free Queue - Part 2 of N
01h 30mLive Lock-Free or Deadlock (Practical Lock-free Programming)
01h 00mConcurrency Improvements in C++20: A Deep Dive
01h 32mLock-free programming with modern C++
01h 04mBack to Basics: Concurrency
01h 08mBetter Code: Concurrency
01h 03mSafety: off --- How not to shoot yourself in the foot with C++ atomics
