Deadlock Detection Algorithm

  1. Mark each process that has a row in the Allocation matrix of all zeros.
  2. Initialize a temporary vector W to equal the Available vector.
  3. Find an index i such that process Pi is currently unmarked and the ith row of Q is less than or equal to W. That is, Qik Wk for 1 k m.  If no such row is found, terminate the algorithm.
  4. If such a row is found, mark process i and add the corresponding row of the allocation matrix to matrix W. That is, set Wk = Wk + Aik  for 1 k m.  Return to setp 3.

A deadlock exists iff there are unmarked processes at the end of the algorithm

Each unmarked process is deadlocked