189
Deadlock detection: example
nMark P4 since it has no allocated resources
nSet W = (0,0,0,0,1)
nP3’s request <= W. So mark P3 and set W = W + (0,0,0,1,0) = (0,0,0,1,1) nAlgorithm terminates. P1 and P2 are deadlocked
R1  R2  R3  R4  R5
P1
P2
P3
P4
Request                            Allocated                        Available
R1  R2  R3  R4  R5
R1  R2  R3  R4  R5
0     1     0     0     1
0     0     1     0     1
0     0     0     0     1
1     0     1     0     1
1     0     1     1     0
1     1     0     0     0
0     0     0     1     0
0     0     0     0     0
0     0     0     0     1