Deadlocks & Liveness
Recognize, prevent and debug deadlocks, livelock, starvation and priority inversion in concurrent programs.
4 objectives 6 steps about 115 min
Check what you know
The lessons are coming later. The knowledge check is ready now.
This skill page is a public outline. Its lessons and knowledge check appear here as subject-matter experts approve them.
Learning objectives
- State the four necessary conditions for deadlock and model a deadlock with a resource-allocation or wait-for graph.
- Prevent deadlocks with a global lock order, lock hierarchies, try-lock with back-off or timeouts, and explain where avoidance and detection fit.
- Diagnose a hung multithreaded process from thread stacks (gdb or /proc) and identify the lock cycle.
- Explain livelock, starvation and priority inversion and how priority inheritance resolves inversion.
Lesson plan
6 steps, about 115 min · 0 of 5 lessons available so far
- Four conditions, one cycle: modeling deadlock with wait-for graphs Concept · 20 min · coming later
- Prevention in practice: global lock order, hierarchies and try-lock with back-off Worked example · 25 min · coming later
- Avoidance and detection: where Banker's algorithm, timeouts and lockdep fit Concept · 15 min · coming later
- Lab: freeze a program, then find the cycle with gdb thread backtraces Lab · 25 min · coming later
- Livelock, starvation and priority inversion, with the Mars Pathfinder case Concept · 15 min · coming later
- Check: diagnose three hangs from stack dumps Knowledge check · 8 questions
Practise it
Take a provided multithreaded transfer program that deadlocks under load, capture thread stacks of the hung process, draw the wait-for graph, fix it with a documented lock order, and add a stress test that completes 1,000 iterations without hanging.
References
Hard prerequisites
Unlocks
Nothing depends on this skill yet.
On these roadmaps
Progress and evidence for this skill are shared across all of them.