What Is Deadlock |
What Is Deadlock , Types Of Deadlock , CONDITIONS OF DEADLOCK
The deadlock is the situation in which two computer processes share only one resource, due to which no process can access the resource, meaning that the deadlock is the condition in which two or more processes only fight for a resource ) Due to which no resource can accessFor example, there are two friends, and both of them want to play computer games because of which both fight. There is a near remote control, the other has the cd of the games. Because of which neither of the two friends is able to play but none of them is ready to cooperate. This situation is called deadlock
deadlock diagram |
According to the picture we have two processes r1 and p2 and two resources are "A" and "B". In this there is resource "A" which is allocation with process r1, and resource "B" which is allocate with process r2. But the process requires "B " to complete the process, so he requests for "B ", but "B" is already allocate with R2.
Similarly process r2 requires "A" to complete its execution, but "A" is already allocate with "A"
Both r1 and r2 are always waiting for each other's resources. This process is called DEADLOCK.
CONDITIONS OF DEADLOCK
The four conditions of the deadlock are as follows:
- Mutual exclusion
- Hold & wait
- no preemption
- circular wait
Mutual xclusion : - In this situation, there is one such resource that can not be shared between processes.
Hold & Wait : - In it, processes hold a resource while waiting for another resource.
No Preemption : - The resource that has been allocated for a process can not be forcibly assigned to any other process.
Circular Wait : - In this situation, each process waits for a resource which is held by another process.
Deadlock |
No comments:
Post a Comment