Back to Basics: Concurrency
summary
Gentle, example‑driven tour of modern C++ concurrency that actually shows code and failures: uses std::thread and jthread, demonstrates data races with 1000 threads, fixes them with mutex/lock_guard/scoped_lock and then shows a cleaner option with std::atomic. Shows deadlock, how exceptions can leak locks, and a working async buffered file loader using async/future/promise that prints interleaved progress. Also mentions pthread linking, thread sanitizers, and why thousands of threads don’t automatically equal speed.
AI-written summary · about
chapters (38)
- 0:00Start
- 0:48Who Am I
- 1:04Foundations of Concurrency
- 1:49Motivation
- 3:55Performance Is the Currency of Computing
- 4:37What Is Concurrency
- 6:35A Memory Allocator
- 8:08Architecture History
- 9:35Dennard Scaling
- 13:43When Should We Be Using Threads
- 14:57C plus Standard Thread Library
- 15:52The Standard Thread Library
- 16:16First Thread Example
- 17:37Thread Join
- 27:28Pitfalls of Concurrent Programming
- 28:32Interleaving of Instructions
- 28:53Data Race
- 29:29Mutex
- 31:06Mutual Exclusion
- 31:55What Happens if the Lock Is Never Returned
- 32:18Deadlock
- 33:05Fix Deadlock
- 35:06Lock Guard
- 36:46Scope Lock
- 40:31Condition Variable
- 41:45Thread Reporter
- 43:21Unique Lock
- 44:29Recap
- 45:52Asynchronous Programming
- 46:24Async
- 50:56Buffered File Loading
- 52:51Thread Sanitizers
- 54:09Co-Routines
- 54:49Memory Model
- 55:17Common Concurrency Patterns
- 56:05Producer Consumer
- 57:34Parallel Algorithms
- 59:10Further Resources
related talks
39mUsing Race Conditions in Correct Concurrent Software
25mOvercoming Concurrency Issues in Web Applications
36mInterfaces Matter
01h 28mPlain Threads are the GOTO of todays computing
23mIntroduction and pitfalls of Java's new concurrency mode
01h 11m“Benchmarking C++ Code"
24mShared Memory & Parallel Programming with JavaScript
01h 00mMoving Faster: Everyday efficiency in modern C++
