cover image

Deadlock

State in which members are blocking each other / From Wikipedia, the free encyclopedia

Dear Wikiwand AI, let's keep it short by simply answering these key questions:

Can you list the top facts and stats about Deadlock?

Summarize this article for a 10 years old

SHOW ALL QUESTIONS

In concurrent computing, deadlock is any situation in which no member of some group of entities can proceed because each waits for another member, including itself, to take action, such as sending a message or, more commonly, releasing a lock.[1] Deadlocks are a common problem in multiprocessing systems, parallel computing, and distributed systems, because in these contexts systems often use software or hardware locks to arbitrate shared resources and implement process synchronization.[2]

Process_deadlock.svg
Both processes need resources to continue execution. P1 requires additional resource R1 and is in possession of resource R2, P2 requires additional resource R2 and is in possession of R1; neither process can continue.
Deadlock_at_a_four-way-stop.gif
Four processes (blue lines) compete for one resource (grey circle), following a right-before-left policy. A deadlock occurs when all processes lock the resource simultaneously (black lines). The deadlock can be resolved by breaking the symmetry.

In an operating system, a deadlock occurs when a process or thread enters a waiting state because a requested system resource is held by another waiting process, which in turn is waiting for another resource held by another waiting process.[3] If a process remains indefinitely unable to change its state because resources requested by it are being used by another process that itself is waiting, then the system is said to be in a deadlock.[4]

In a communications system, deadlocks occur mainly due to loss or corruption of signals rather than contention for resources.[5]

Two_processes%2C_two_resources.gif
Two processes competing for two resources in opposite order.
  1. A single process goes through.
  2. The later process has to wait.
  3. A deadlock occurs when the first process locks the first resource at the same time as the second process locks the second resource.
  4. The deadlock can be resolved by cancelling and restarting the first process.