Penguin

A DeadLock occurs when two (or more) threads or processes have locks on shared resources, distributed in such a way that noone can proceed. This occurs when, f.ex, both process P1 and P2 need access to resources R1 and R2, where P1 has managed to lock R1 while P2 has locked R2. At this point, both processes will wait for each other to release the respective lock indefinitely, hence a DeadLock.

The DeadlyEmbrace is a particularly trivial example of a DeadLock.

A DeadLock is considered better than a RaceCondition, mainly because with a DeadLock something is obviously wrong, while a RaceCondition will happily destroy data completely silently.

See also DiningPhilosophers.


CategoryProgrammingBugs