A total of 9 units of a resource type available, and given the safe state shown below, which of the following sequence will be a safe state?
Process Used Max P1 2 7 P2 1 6 P3 2 5 P4 1 4
(A) (P4, P1, P3, P2)
(B) (P4, P2, P1, P3)
(C) (P4, P2, P3, P1)
(D) (P3, P1, P2, P4)
Explanation: Applying Banker’s Algorithm, Need matrix of the processes are:
Process Used Max Need P1 2 7 5 P2 1 6 5 P3 2 5 3 P4 1 4 3
Currently Available resources = Available – Allocated resources = 9 – 6 = 3
If the request of P4 is granted first then it would release a maximum of 4 resources after its execution, and if P1 or P2 are allocated next then their requests can not be fulfilled as both of them require 5 resources each.
So, that eliminates Options (A), (B) and (C).
Option (D) is correct.
Quiz of this Question
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.