An Introduction to Multithreading in C++20
summary
Where to start with C++20 multithreading is practical advice not theory: use jthread with stop_token so destructors request stop and join, use parallel algorithms for large data sets but note Amdahl examples like 90% parallel on 1,000 cores gives only ~9.9× speedup, and C++20 lacks standard executors so use third‑party thread pools. Prefer latch and barrier for coordination, futures/promises for one‑shot transfers, mutexes/condition_variable_any for shared state, and reach for semaphores or atomics only as a last resort.
AI-written summary · about
chapters (31)
- 0:00Start
- 0:14Simplifying Assumptions
- 0:51Concurrency Model
- 4:10Scalability
- 5:49Panel Algorithms
- 11:24Cooperative Cancellation
- 13:05Stop Source
- 19:53Starting and Managing Threads
- 20:13Standard Async
- 26:37C plus 11 Standard Thread
- 31:19Synchronization Facilities
- 37:50Multi-Threaded Tests
- 40:32Barriers
- 42:57Barrier Api
- 44:19Arrive and Drop
- 45:28Loop Synchronization
- 47:54One-Shot Transfer of Data between Threads
- 49:31Promise
- 49:46Package Task
- 50:30Default Constructed Future
- 55:42Async
- 59:01Mutex Types
- 59:39Shared Mutex
- 1:00:48Locking and Unlocking
- 1:02:33Lock Multiple Mutexes
- 1:04:20Mutex
- 1:11:10Semaphores
- 1:13:20Counting Semaphore
- 1:15:16Atomics
- 1:23:52Are the Thread Executives Supposed To Be Available Soon
- 1:26:06Summary
related talks
59mAn Introduction to Multithreading in C++20
01h 24mConcurrency in C++20 and Beyond
47mConcurrent Programming in C++
47m“Multithreading is the answer. What is the question? (part 1 of 2)”
01h 04mBack to Basics: Concurrency
50mC++ Parallel Programming Models
01h 04mConcurrency in C++20 and Beyond
58mMultithreading with Qt
