Answer:
a. safe sequence is T2 , T3, T0, T1, T4.
b. As request(T4) = Available, so the request can be granted immediately
c. As request(T2) < Available, so the request can be granted immediately
d. As request(T3) < Available, so the request can be granted immediately.
Explanation:
It will require matrix
[i, j] = Max [i, j] – Allocation [i, j]
A B C D
T0 3 3 3 2
T1 2 1 3 0
T2 0 1 2 0
T3 2 2 2 2
T4 3 4 5 4
Available = (2 2 2 4)
1. Need(T2) < Available so, T2 can take all resources
Available = (2 2 2 4) + (2 4 1 3) (Allocation of T2) = (4 6 3 7)
2. Need(T3)<Available so, T3 will go next
Available = (4 6 3 7) + (4 1 1 0) = (8 7 4 7)
Like wise next T0, T1, T4 will get resources.
So safe sequence is T2 , T3, T0, T1, T4.
(Note, there may be more than one safe sequence).
Solution b.
Request from T4 is (2 2 2 4) and Available is (2 2 2 4)
As request(T4) = Available, so the request can be granted immediately.
Solution c.
Request from T2 is (0 1 1 0) and Available is (2 2 2 4)
As request(T2) < Available, so the request can be granted immediately.
Solution d.
Request from T3 is (2 2 1 2) and Available is (2 2 2 4)
As request(T3) < Available, so the request can be granted immediately.