Explain Deadlock Detection Algorithm

Q1.  Explain Deadlock Detection.

Ans. Following are the step of Deadlock Detection Algorithm:

Step 1:

Let work and finish the vectors of length ‘m’ and ‘n’.

Initialize work = available

for i=1 … N

if Allocationi ≠ 0

then

Finish[i] = False

else

Finish[i] = True

Step2:

Find an index ‘i’, such that both

a)    Finish[i] = False.

b)    Requesti ≤ Work //Requesti ≤ Available

If no such ‘i’ exit go to step 4.

Step 3:

Work = Work + Available

//Available = Available + Allocation

Finish[i] = True

Go to step 2.

Step 4:

If Finish[i] = False

for some i, i ≤ n

then

the system is in deadlock, process Pi in deadlock.

Leave a Reply

Your email address will not be published. Required fields are marked *

93 Views
%d bloggers like this: