Computer Science › Section D · Operating systems › Topic D.5
Competition among processes: semaphores and deadlock
When many processes share one printer, one file or one bank balance, a badly timed switch can corrupt data or freeze the system. This topic shows how operating systems use semaphores to let only one process at a time into a critical region, and how they prevent or escape deadlock.
In this topic
- Sharing is harder than it looks
- A flag that fails
- Worked example: a lost update
- Making test-and-set indivisible
- Semaphores and critical regions
- Worked example: a counting semaphore
- Deadlock
- The four conditions
- Worked example: finding and breaking a cycle
- Three ways to handle deadlock
- Common mistakes to avoid
- Key takeaways
This topic is part of Wuanberri Pro. Checking your access…
