⏱️ Latency: A Practical Guide in C++
Home Chapters Examples Lab Setup Diagrams Bibliography GitHub ↗
Home / Concurrency and Synchronization
Part 3 2 chapters

Concurrency and Synchronization

Hand off work between threads without a lock, and split it across cores correctly.

Chapter 5

Wait-free synchronization

The scan-to-divert handoff rebuilt from a mutex-guarded queue, where the consumer sleeps and the producer waits on the same lock, into a fixed-capacity ring where neither thread ever blocks, plus the same ring in Rust, where the compiler rejects the race the C++ version depends on a reviewer to catch.

30 minutesRead →
Chapter 6

Exploiting concurrency

The sort decision fanned out across the diverter lanes three ways: sequential, data-parallel (fixed slices across std::jthread), and task-parallel (one task per parcel through a thread pool), measured for throughput against the scan-to-divert deadline, plus the identical data-parallel split in Rust, where the disjoint output split is a compiler-checked borrow instead of a convention.

30 minutesRead →
← Previous part Eliminating Work Next part → Scaling and the Host

Latency: A Practical Guide in C++

A chapter-based guide to latency engineering in C++23, one pattern per chapter, measured on a parcel sortation line.

Tutorial

  • Chapters
  • Examples
  • Diagrams
  • Bibliography

Reference

  • cppreference.com ↗
  • View on GitHub ↗
  • Issues ↗
Open source · Apache 2.0 (code) / CC BY 4.0 (docs) Last built 2026-11-30