Atomics, Locks, and Tasks (part 1 of 2)
summary
Shows an atomic counter example to argue that C++ atomics only solve simple per-operation correctness and do not maintain multi-step invariants, so data races can still occur when several steps must stay consistent. Demonstrates a first-lock/second-lock deadlock pattern to explain why lock ordering or protocols are needed, and presents tasks and std::future/std::async as higher-level alternatives to raw threads—futures carry exceptions/notifications and tasks enable producer/consumer flows without condition variables. Mentions using the parallel STL for declarative concurrency and discusses the performance tradeoffs of these approaches.
AI-written summary · about
chapters (7)
- 0:00Introduction
- 7:09Atomic operations basics
- 17:11Locking mechanisms explained
- 22:16Deadlock scenarios
- 35:17Locking in practice
- 46:21Introduction to tasks
- 52:49Q&A
related talks
01h 04mBack to Basics: Concurrency
01h 08mBetter Code: Concurrency
01h 03mSafety: off --- How not to shoot yourself in the foot with C++ atomics
01h 00mConcurrency in C++20: A Deep Dive
01h 14m“C++ atomics, from basic to advanced. What do they really do?”
01h 24mConcurrency in C++20 and Beyond
39mLive Lock-Free or Deadlock (Practical Lock-free Programming)
01h 03mUsing weakly ordered C++ atomics correctly
