
Deadlock occurs when two or more processes or threads are unable to proceed because each is waiting for the other to release a resource. It is a situation where the processes or threads are stuck in a circular wait, resulting in a standstill. Deadlock leads to a complete system freeze, and the only way to resolve it is by terminating one or more processes or by breaking the circular wait condition.
Livelock occurs when two or more processes are actively trying to resolve a resource conflict, but their attempts to do so prevent any of them from making progress. It is like a never-ending loop of resource contention, where processes repeatedly back off and retry to access the resource, causing continuous contention without any forward progress. Livelock is also a situation of resource starvation, but unlike deadlock, the processes are not blocked; they are actively trying to access the resource.
Few scenarios where deadlock and livelock can occur:
In distributed systems, where multiple nodes need to communicate and share resources, deadlock can occur when two or more nodes are waiting for each other to release a resource, leading to a system freeze. Livelock can occur when nodes keep retrying to access a shared resource, causing excessive contention and little or no actual work.
In resource management systems, such as resource allocation in cloud computing, deadlocks can occur when multiple tasks or processes are waiting for specific resources to be released. Livelock can occur when resource requests are continuously being reissued, leading to resource contention and inefficient resource utilization.
In traffic control systems, deadlocks can occur when traffic signals get stuck in a circular wait, leading to traffic congestion. Livelock can occur when traffic signals keep switching between states without allowing any direction to proceed efficiently, causing traffic jams. The livelock causes a deadlock-like situation where the traffic flow becomes inefficient and effectively comes to a standstill. Even though all vehicles are trying to move, they are unable to do so in a coordinated manner due to the continuously fluctuating traffic lights.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
An Article by: Yashwanth Naidu Tikkisetty
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
