- Previously, we talked about threads
- What is a mutex?
- Mutual exclusion (venn diagram, where the 2 circles don't meet)
- Why do we need mutex?
- Prevent race conditions + data corruption
- Show how threads can overwrite data
- How does mutex fix it?
- Lock/unlock outside the for-loop
- Why you need to be careful with mutexes?
- Lock/unlock inside the for-loop
-
10x Slower: The Cost of a Misplaced Mutex in C++
-
How One Line of C++ Can Tank Your Performance
-
Why Your C++ Mutex is 10x Slower Than It Should Be
-
Intro to Mutex | C++ Multithreading Tutorial
-
The C++ Mutex Mistake You Didn't Know You Were Making
-
The Performance Killer: Locking Inside vs. Outside the Loop
- ChatGPT and Gemini