� Abort all deadlocked processes:����� this method clearly will break the deadlock cycle, but at a great expense, since these processes may have computed for a long time, and the results of these partial computations must be discarded, and probably must be recomputed later
� Abort one process at a time until the deadlock cycle is eliminated:����� this method incurs considerable overhead, since, after each process is aborted, a deadlock-detection algorithm must be invoked to determine whether any processes are still deadlock
� Minimum cost
Showing posts with label os8. Show all posts
Showing posts with label os8. Show all posts
Thursday, August 20, 2009
DEADLOCK DETECTION
� An algorithm that examines the state of the system to determine whether a deadlock has occurred
� An algorithm to recover from the deadlock
� An algorithm to recover from the deadlock
DEADLOCK PREVENTION
>By ensuring that at least one of these conditions cannot hold, we can prevent the occurrence of a deadlock.
METHODS FOR HANDLING DEADLOCKS
� We can use a protocol to ensure that the system will never enter a deadlock state.
� We can allow the system to enter a deadlock� state and then recover
� We can ignore the problem all together, and pretend that deadlocks never occur in the system.� This solution is the one used by most operating systems, including UNIX.
� Deadlock prevention is a set of methods for ensuring that at least one of the necessary conditions cannot hold.
� Deadlock avoidance, on the other hand, requires that the operating system be given in advance additional information concerning which resources a process will request and use during its lifetime.
� We can allow the system to enter a deadlock� state and then recover
� We can ignore the problem all together, and pretend that deadlocks never occur in the system.� This solution is the one used by most operating systems, including UNIX.
� Deadlock prevention is a set of methods for ensuring that at least one of the necessary conditions cannot hold.
� Deadlock avoidance, on the other hand, requires that the operating system be given in advance additional information concerning which resources a process will request and use during its lifetime.
DEADLOCK CHARACTERIZATION
A deadlock situation can arise if the following four conditions hold simultaneously in a system:
� Mutual exclusion� at least one resource must be held in a non-sharable mode; that is, only one process at a time can use the resource.� If another process requests that resource, the requesting process must be delayed until the resource has been released.
� Hold and wait� there must exist a process that is holding at least one resource and is waiting to acquire additional resources that are currently being held by other processes.
� No preemption resources cannot be preempted; that is, the process holding it after that process has completed its task can release a resource only voluntarily by the process holding it, after that process has completed its task.
� Circular wait� there must exist a set {Po,P1,�,Pn} of waiting processes such that P0 is waiting for a resource that is held by P1,P1 is waiting for a resource that is held by P2,�,Pn-1 is waiting for a resource that held by Pn and Pn is waiting for a resource that is held by Po.
� Mutual exclusion� at least one resource must be held in a non-sharable mode; that is, only one process at a time can use the resource.� If another process requests that resource, the requesting process must be delayed until the resource has been released.
� Hold and wait� there must exist a process that is holding at least one resource and is waiting to acquire additional resources that are currently being held by other processes.
� No preemption resources cannot be preempted; that is, the process holding it after that process has completed its task can release a resource only voluntarily by the process holding it, after that process has completed its task.
� Circular wait� there must exist a set {Po,P1,�,Pn} of waiting processes such that P0 is waiting for a resource that is held by P1,P1 is waiting for a resource that is held by P2,�,Pn-1 is waiting for a resource that held by Pn and Pn is waiting for a resource that is held by Po.
Subscribe to:
Posts (Atom)