Section 18.7, see Figure 18.7 for notation

 

Deadlock detection algorithm

The algorithm below marks the rows of the allocation matrix A

corresponding to processes which are not part of a deadlocked set.

 

1. Mark all null rows of A.

(A process holding no objects cannot be part of

a deadlocked cycle of processes.)

 

2. Initialise a working vector W = V, the available objects.

 

3. Search for an unmarked row, say row i,

such that Bi <= W

(the objects that process i is requesting are "available" in W)

 

If none is found terminate the algorithm.

 

4. Set W = W + Ai and "mark" row i.

Return to step 3.

 

When the algorithm terminates,

unmarked rows correspond to deadlocked processes.