Race Conditions - Practical Tools & Techniques for Testing, Preventing, and Debugging C++/C Code
summary
Shows concrete tools and tradeoffs: ThreadSanitizer (clang/gcc) finds many data races fast (compiler instrumentation, ~2x slowdown) but misses ordering races; Helgrind/DRD via Valgrind (binary-level, 100–200x slowdown) works without recompiling and catches different bugs; demonstrating GDB’s thread view and scheduler locking clarifies stepping behavior; and time‑travel recording + reverse‑continue lets you load a single failing run and follow which thread wrote a value. Also warns that adding a mutex can hide races from detectors and that fuzzing plus sanitizers finds more.
AI-written summary · about
chapters (20)
- 0:00Race conditions in C++/C
- 1:53Race conditions and challenges
- 3:18Debugging tools for races
- 4:03ThreadSanitizer demo
- 5:50ThreadSanitizer output limits
- 7:15How ThreadSanitizer detects races
- 8:40Configuring ThreadSanitizer
- 10:07Valgrind and Hellgrind
- 11:31Hellgrind vs ThreadSanitizer
- 12:38Sanitizers vs Valgrind
- 14:45Q&A on sanitizers
- 16:51Fixing races with mutexes
- 17:55Common race conditions
- 20:03Flaky failures and races
- 20:44Debugging with GDB
- 22:51GDB thread handling
- 26:45GDB misconceptions and LLDB
- 27:31Time Travel Debugging
- 29:21Time Travel Debugging demo
- 30:45Summary
related talks
57mModern Linux C++ debugging tools - under the covers
44mA Guide to Debugging C++ Code: Practical and Interactive Examples
42mUnderstanding Data Races in the Linux Kernel
54mCatching Real-time Safety Violations in C++
01h 02mSanitize your C++ code
01h 29mModern Linux C++ Debugging Tools - Under the Covers
57mC++ MythBusters Strike 2
57mLessons from 20 years of Debugging C++ Code
