Q1. Explain Safety Algorithm.
Ans. Following are the steps taken in Safety Algorithm:
Let work and finish the vectors of length ‘m’ and ‘n’ respectively.
Initialize work=available and
If finish [i]=false
for i=0 to n-1
Find an i such that both
b) needi ≤ work[or available]
If no such exist, go to step 4.
Work = Work + Allocation
Go to step 2.
If finish[i]=true for all i, then the system in a safe state.