· When two or more processes want to share a non-sharable resource.
· When a process acquired one resource and wants to acquire another resource to get completed. But, that needed resource is acquired by another process.
· Preempting a resource simply means that one process having higher priority will violently release and acquire the resources which are already possessed by another process.
· Another condition for deadlock is circular wait. Let the processes are within a sequence {p0, p (1), p (2)........p (n)} now p0 is waiting for p1 for resource and p1 is dependant on p2 for resource and.......... P (n) is waiting for p0.
These are the conditions, if one of them will occur in the system than we can say that system is under deadlock. Now I am discussing here that how to recover from deadlock:
Process termination:
It is a method in which all the processes which are grouped into the deadlock cycle are aborted. This can be done by two methods.
First method is to abort all the processes which are in the deadlock cycle. This will be at great expense because many of these processes are about to finish. And it will causes recomputation of these processes from the scratch.
The second method is that in which we abort only a single process from the deadlock cycle. And again check for the deadlock. If any deadlock cycle still exists then we again abort another process and check for the deadlock condition again. This process will continue until we recover from deadlock. But this process will also causes abortion of process which is about to complete. And we have to again execute that process from starting.
So we have to set a termination condition for the processes:
· About the priority of process
· How long it will take to complete its task
· How many and what type of resources has used by the process
· How many more processes are needed
Resource preemption:
To eliminate the deadlock condition another approach is preemption. We preempt some resources from processes and give these resources to other processes until we recover from the deadlock condition. For this we have to deal with following three conditions:
· First aspect to keep in mind is to select a victim. The victim is selected in such a manner that the cost factor is reduced to its minimum value. Cost factor will refer to the time it will still take and the resources it is holding.
· As we abort a process and then we have to start the code from the starting. It is missing some needed resources. Now rollback the process and restart it from the starting i.e. determine its safe state. But it is very difficult to find a safe state. It is an efficient method to recover from deadlock but the only problem is to keep information about the running state of all the processes.
· Sometimes a process is selected again and again as victim. It may also happen that this process will wait for a long time. It will cause the problem of starvation. Starvation means that a process is selected again and again as a victim i.e. another processes will preempt that process for resources. This problem can be handled through "aging". It will increase the cost factor of that process which will get preempt again and again. We will ensure that a same process can't be preempted again and again.
So, by following any of the above two methods we can easily recover form the deadlock condition.
Published by Harsh Gupta - Tech Writer
I am a part time freelancer and writing is my hobby Some of my websites: http://www.GenericArticles.com http://www.JailBreakingiPhone.com View profile
Windows Server 2008: The Most Powerful Operating System YetWindows Server 2008 is scheduled to be the next server operating system released by Microsoft. It is widely regarded as the most crucial enterprise launch in Microsoft's history...- 5 Easy Steps to Install an Operating SystemInstalling an Operating system is so easy that anyone can do it. You may just be reluctant to try thinking you might not know how to do it. Honestly, its really simple.
Is Windows.Next The Next Microsoft Windows Operating System?Microsoft recently released Windows 7 on Oct. 22, 2009 and the rumors for the Next Windows operating system have already started (Windows 8 / Windows.next). I'm still confused,...
Ubuntu Linux: What the Popular Open Source Operating System Has to OfferUbuntu Linux is a popular, open source, linux-based operating system. Ubuntu serves as an affordable alternative to the more popular Windows and Macintosh operating systems. Thi...
Three Reasons Why Ubuntu is the Best Linux Operating SystemLinux is an "open source" operating system, meaning that it can be modified and distributed freely. Because of this fact there are hundreds of Linux distributions in circulation...
- Blood Diner
- The Contribution of Human Resource Management to Organisational Performance
- Human Resource Management in Several Environments
- How World War Two was a Direct Result of World War One
- The Three Types of Break Ups
- Kant & Watchmen: War, Conflict and the Progression of Human History
- Battlestar Galactica: Daybreak Part One
- It is a method in which all the processes which are grouped into the deadlock cycle are aborted.
- Second method is that in which we abort only a single process from the deadlock cycle.
- To eliminate the deadlock condition another approach is preemption.
