Sobes.tech
Middle+

What are Deadlock and Livelock? What is the difference?

sobes.tech AI

Answer from AI

Deadlock — a situation where two or more processes are permanently blocked, each waiting for a resource held by the other. For example, process A holds resource 1 and waits for resource 2, while process B holds resource 2 and waits for resource 1.

Livelock — a situation where processes are not blocked but constantly change their state in response to each other, making no progress. For example, two processes continually yield resources to each other but neither can continue work.

Difference:

  • Deadlock — processes wait for each other and do not change their state.
  • Livelock — processes are active and change their state, but there is no progress.