An introduction to multithreading in C++20
summary
Starts with concrete tools and rules: use std::jthread (destructor calls request_stop and joins), cooperate with stop_token/stop_source for cancellation, prefer parallel algorithms and transform_reduce for large-data speedup, or a thread-pool for many small tasks. Gives an Amdahl example: 90% parallel yields only ~9.9× on 1000 cores. Covers latches, barriers, futures/promises, condition_variable_any, semaphores and atomics, warns mutexes hurt scalability and that a standard thread pool is not yet in the standard.
AI-written summary · about
chapters (16)
- 0:00Multithreading in C++20
- 1:04Choosing concurrency model
- 5:46Amdahl's law for scalability
- 9:24Parallel algorithms with policies
- 13:37Thread pools for tasks
- 17:29Cooperative cancellation with stop tokens
- 24:31Managing threads with jthread
- 33:03Synchronizing shared data
- 35:08Latches for thread sync
- 40:24Barriers for loop sync
- 46:01Futures and promises
- 52:45Mutexes and locks
- 55:36Condition variables
- 57:44Semaphores for sync
- 59:33Atomics for lock-free
- 1:01:19Summary
related talks
57mMultithreaded and Asynchronous Programming in .NET
42mConcurrency Options on the JVM
01h 06mHow to debug Linux multi threaded code
01h 13mC++ Modules and Large-Scale Development (Part 2)
33mAsync patterns to scale your multicore JavaScript elegantly.
01h 00mThe Hitchhiker's Guide to Faster Builds
31mA JVM threading model for the containerized times
20mWait, What? C# Async-Await Explained
