Operating systems notes
Race Conditions & the Critical Section
What breaks the instant two threads touch the same data, and the exact problem every lock exists to solve. Every section is a drawn page beside a clear written explanation, about 16 minutes in all.
- Chapter 14 of 37
- About 16 minutes
- 7 sections
Sign in with Google or GitHub and you land straight on this page. DSA comes with the all labs plan and every ChaiCode batch.

In this chapter
- When sharing goes wrong
- Anatomy of a race: count++ is three steps
- The critical section
- The three requirements of a correct solution
- A naive attempt, and why it fails
- Atomicity, and why "just be careful" fails
- Where this bites engineers
Next chapters
Read the whole chapter
Sign in and the chapter opens with every drawn page, and all 38 operating systems chapters beside it.
DSA comes with the all labs plan and every ChaiCode batch.