Dead lock:
Dead lock can be defined formally as follow ...
A set of process is dead lock.If each process in the set is waiting for an event that only another process in the set can calls.
Condition for dead lock:
Commander all showed that condition must showed there should be the dead lock.
Mutual-exclusion condition:
Each-resource is either currently assigned to exactly one process (or) is available.
Hold and wait:
Process currently holding resources granted earlier can request new resources.
Non preemptive condition:
Resource previously granted can not be forcefully taken away from the process.They must be explicitly released by the process holding them.
Circular wait:
They must be a circular chain of two (or) more process each of which is waiting for a resource held by the next number of the chain.
All four of then condition must be present dead lock to occur.It one of them is absent no dead lock is possible.
Dead lock modeling:
Resource node represent with square process node represent with circle.
p0 p1
| |
r0 r1
A request R
B request S
C request T A->B->C->A
A request R
B request S
C request T