Concurrency in C++20: A Deep Dive
summary
C++20 actually adds concrete primitives and shows measured tradeoffs: atomic_flag stays the only guaranteed lockfree atomic, compare_exchange_strong underpins lockfree algorithms, and atomics gain wait/notify that block when the value matches a predicate. The library adds atomic_ref, atomic shared/weak pointer wrappers (currently locking), counting and binary semaphore, latch and barrier for one‑shot and reusable joins, cooperative interruption with stop_token/stop_source, jthread that auto‑joins, and synchronized output; benchmarks show condition_variable is slow while semaphores match atomics for a 1M ping‑pong.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 1:12Atomic operations
- 9:49Atomic waiting and notification
- 11:55Atomic smart pointers
- 15:00Atomic reference
- 19:18Semaphores
- 23:54Condition variables
- 34:02Ping pong game comparison
- 41:30Latches and barriers
- 47:33Cooperative interruption
- 55:41Jthread and synchronization
- 57:07Summary and conclusions
related talks
01h 00mConcurrency Improvements in C++20: A Deep Dive
01h 24mConcurrency in C++20 and Beyond
01h 04mConcurrency in C++20 and Beyond
01h 07mThe C++20 Synchronization Library
01h 14m“C++ atomics, from basic to advanced. What do they really do?”
01h 03mSafety: off --- How not to shoot yourself in the foot with C++ atomics
01h 04mBack to Basics: Concurrency
59mAn Introduction to Multithreading in C++20
