![]() ![]() Deadlock Prevention in Operating SystemĪ process is a set of instructions. In this article, we will learn about deadlock prevention in OS.ĭeadlock prevention is a set of methods used to ensure that all requests are safe, by eliminating at least one of the four necessary conditions for deadlock. Deadlock prevention and deadlock avoidance are carried out before deadlock occurs. If there is already traffic on road, then a car coming from the opposite direction can cause blockage.ĭeadlock detection & recovery: OS detects deadlock by regularly checking the system state, and recovers to a safe state using recovery techniques.Įxample: Unblocking the road by backing cars from one side. Any request that may result in a deadlock is not granted.Įxample: Checking each car and not allowing any car that can block the road. Deadlock happens only when all four conditions occur simultaneously for unshareable single instance resources.ĭeadlock prevention: The possibility of deadlock is excluded before making requests, by eliminating one of the necessary conditions for deadlock.Įxample: Only allowing traffic from one direction, will exclude the possibility of blocking the road.ĭeadlock avoidance: Operating system runs an algorithm on requests to check for a safe state. There are four necessary conditions for deadlock. We can understand this from the above example, two cars require the road at the same time but it cannot be shared as it is one way. We can say that the road is a single instance resource (only one unit of resource is available).Ī deadlock in the operating system is a situation of indefinite blocking of one or more processes that compete for resources.ĭeadlock involves resources needed by two or more processes at the same time that cannot be shared. ![]() As it is a one-way road, both cars cannot move forward at the same time. Now, none of the cars can move further and have entered a waiting state. Here the road is the resource required by cars and cars getting to the other side of the road can be considered a process. Let’s understand deadlock with a real-life example, consider a one-way road where two cars coming from opposite directions have blocked each other’s passage. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |