An Introduction to Multithreading in C++20
summary
Line-by-line practical guide to C++20 concurrency: picks separation of concerns vs scalability as the design axis, demonstrates Amdahl’s law (90% parallelized still gives ~9.9× on 1000 cores), and shows concrete APIs to use — std::execution::par, third‑party thread pools until P2300 lands, and jthread with stop_token/stop_callback for cooperative cancellation. Covers usable sync primitives in priority order (latch, barrier, future, mutex, semaphore, atomic) and explains when each actually works and why.
AI-written summary · about
chapters (12)
- 0:00Start
- 0:16Assumptions
- 1:33Choosing your Concurrency Model
- 2:53Multithreading for Scalability
- 5:29Parallel Algorithms
- 25:55Threads: Callables and Arguments
- 30:47Synchronization facilities
- 34:52Waiting for tasks with a latch
- 38:31Barriers std::barriers is a reusable barrier, Synchronization is done in phases: . Construct a barrier, with a non-zero count and a completion function o One or more threads arrive at the barrier
- 52:47Locking mutexes
- 53:21Locking multiple mutexes
- 57:59Summary
related talks
01h 28mAn Introduction to Multithreading in C++20
47mConcurrent Programming in C++
01h 24mConcurrency in C++20 and Beyond
01h 08mBetter Code: Concurrency
47m“Multithreading is the answer. What is the question? (part 1 of 2)”
01h 04mBack to Basics: Concurrency
01h 04mAtomics, Locks, and Tasks (part 2 of 2)
01h 07mThe C++20 Synchronization Library
