You are reading the article Livelock: What Is, Example, Difference With Deadlock updated in September 2023 on the website Lanphuongmhbrtower.com. We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested October 2023 Livelock: What Is, Example, Difference With Deadlock
What is Livelock?A Livelock is a situation where a request for an exclusive lock is denied repeatedly, as many overlapping shared locks keep on interfering each other. The processes keep on changing their status, which further prevents them from completing the task. This further prevents them from completing the task.
In this operating system tutorial, you will learn:
Examples of LivelockExample 1:
An easiest example of Livelock would be two people who meet face-to-face in a corridor, and both of them move aside to let the other pass. They end up moving from side to side without making any progress as they move the same way at the time. Here, they never cross each other.
Example 2:
You can see in the above image, each of the two given processes needs two resources, and they use the primitive polling enter registry to try to acquire the locks necessary for them. If the attempt fails, the method works again.
Process A hold Y resource
Process B holds resource X
Process A require X resource
Process B require Y resource
Assuming, process A runs first and acquires data resource X and then process B runs and acquires resource Y, no matter which process runs first, none of them further progress.
However, neither of the two processes are blocked. They use up CPU resources repeatedly without any progress being made but also stop any processing block.
Therefore, this situation is not that of a deadlock because there is not a single process that is blocked, but we face the situation something equivalent to deadlock, which is LIVELOCK.
Livelock occurs when the total number of allowed processes in a specific system should be defined by the total number of entries in the process table. Therefore, process table slots should be referred to as Finite Resources.
What is Deadlock?A deadlock is a situation that occurs in OS when any process enters a waiting state because another waiting process is holding the demanded resource. Deadlock is a common problem in multi-processing where several processes share a specific type of mutually exclusive resource known as a soft lock or software.
Example of Deadlock
A real-world example would be traffic, which is going only in one direction.
Here, a bridge is considered a resource.
So, when Deadlock happens, it can be easily resolved if one car backs up (Preempt resources and rollback).
Several cars may have to be backed up if a deadlock situation occurs.
So starvation is possible.
Example of deadlock
What is Starvation?Starvation is a situation where all the low priority processes got blocked, and the high priority processes proceed. In any system, requests for high/low priority resources keep on happening dynamically. Thereby, some policy is require to decide who gets support when.
Example of Starvation: Difference Between Deadlock, Starvation, and Livelock
A deadlock is a situation that occurs in OS when any process enters in a waiting state because the demanded resource is being held by another waiting process.
A livelock, on the other hand, is almost similar to a deadlock, except that the states of the processes which are involved in a livelock always keep on changing to one another, none progressing.
So, Livelock is a unique case of resource starvation.
Summary:
Definition: A Livelock is a situation where a request for an exclusive lock is denied repeatedly, as many overlapping shared locks keep on interfering each other.
Livelock occurs when the total number of allowed processes in a specific system should be defined by the total number of entries in the process table
A deadlock is a situation that occurs in OS when any process enters a waiting state because another waiting process is holding the demanded resource.
A real-world example would be traffic, which is going only in one direction.
An example of Livelock would be two people who meet face-to-face in a corridor, and both of them move aside to let the other pass.
Starvation is a situation where all the low priority processes got blocked, and the high priority processes proceed.
You're reading Livelock: What Is, Example, Difference With Deadlock
Update the detailed information about Livelock: What Is, Example, Difference With Deadlock on the Lanphuongmhbrtower.com website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!