Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Lock-Free SPSC Ring Buffers

Status Draft outlineSection Concurrency

A single-producer/single-consumer ring exploits exclusive ownership of the write and read positions. Lock-free does not mean synchronization-free.

Planned model

Animate producer and consumer cursors, wraparound, full and empty states, data publication, cache-line placement, and acquire-release edges.

Questions

  • Which cursor may each thread modify?
  • How is a written slot published before it is observed?
  • How are full and empty distinguished safely?

Exercise

State the invariants and memory orderings for a fixed-capacity SPSC queue before implementing any unsafe storage.