OS

Safety Algorithm

1. Let Work and Finish be vectors of length m and n, respectively.
Initialize:
Work = Available
Finish [i] = false for i = 0, 1, …,n- 1.

2. Find and i such that both:
(a) Finish [i] = false
(b) Needi≤Work

If no such i exists, go to step 4.

3. Work = Work + Allocationi
Finish[i] = true
go to step 2.

4. If Finish [i] == true for all i, then the system is in a safe state.

Leave a comment

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