Mutual exclusion
Some resources (printers, mutexes, GPUs) allow only one owner at a time. If everything were shareable, deadlock couldn’t occur.
Explore how several processes request, hold, and release resources at your own pace. Step through animated graphs, compare safe and unsafe schedules.
Core ideas
Keep these cards nearby and check off each condition when you see it happen during the animation.
Some resources (printers, mutexes, GPUs) allow only one owner at a time. If everything were shareable, deadlock couldn’t occur.
Processes keep current allocations while asking for more. Try predicting when a process should release to avoid trouble.
Locks, semaphores, or hardware devices usually can’t be stolen. A process must cooperate and release them willingly.
When requests form a cycle in the wait-for graph, progress stops. Break any edge in that cycle to recover.
Hands-on playground
Three processes (P1–P3) fight over three single-instance resources (R1–R3). Step slowly, narrate what changed, then switch to a safe ordering to see how a different policy keeps the system healthy.
Step 1 / 1
Pick a scenario to begin.
granted resource
pending request
deadlock alert
Apply the lesson
Impose a total ordering on resource requests or force processes to release everything before requesting new items.
Banker’s algorithm simulates the grant to ensure the system remains in a safe state. If not, delay the request yourself.
Periodically inspect the wait-for graph for cycles. Once you find one, preempt, roll back, or terminate a process.