Definition of Deadlock , example and its conditions.

DEADLOCK

DEADLOCK DEFINITION:

“Two processes are involved in deadlock if and only if they are waiting for an event which would never happen.”
“A process requests resources; if the resources are not available at that time, the process enters a wait state. Waiting processes may never again change state, because the resources they have requested are held by other waiting processes. This situation is called a deadlock”

EXAMPLE OF DEADLOCK :

• To illustrate a deadlock state, we consider a system with three tape drives. Suppose each of three processes holds one of these tape drives.
• If each process now requests another tape drive, the three processes will be in a deadlock state. Each is waiting for the event "tape drive is released," which can be caused only by one of the other waiting processes.
• This example illustrates a deadlock involving the same resource type. Deadlocks may also involve different resource types

NECESSARY CONDITIONS FOR DEADLOCK

• A deadlock situation can arise if the following four conditions hold simultaneously in a system:
1. 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.
2. Hold and wait: A process must be holding at least one resource and waiting to acquire additional resources that are currently being held by other processes.
3. No preemption: Resources cannot be preempted; that is, a resource can be released only voluntarily by the process holding it, after that process has completed its task.
4. Circular wait: A set {P1, ..., Pn-1,Pn) of waiting processes must exist such that P1 is waiting for a resource that is held by P2, P2 is waiting for a resource that is held by P3,...Pn-1 is waiting for Pn, Pn is waiting for a resource that is held by P1.

Posted on by