Correct option is C
To determine the number of possible safe sequences using the
Banker's Algorithm, let’s calculate step by step. This involves verifying if the system is in a safe state and identifying all possible safe sequences.
Given,
Allocated Resources:
Maximum Need:
Available Resources:
Step-by-Step Calculation:
1.
Calculate the Need matrix:
Need=Maximum Need−Allocated
2.
Find Safe Sequences:
We need to find sequences where each process can be completed without causing a deadlock. We start with
Available = [3, 2, 1].
Checking possible sequences:
1.
P4: Need [0, 1, 1] ≤ Available [3, 2, 1]
· P4 can be satisfied.
· New Available = [3 + 2, 2 + 1, 1 + 1] = [5, 3, 2]
2.
P2: Need [1, 2, 2] ≤ Available [5, 3, 2]
· P2 can be satisfied.
· New Available = [5 + 2, 3 + 0, 2 + 0] = [7, 3, 2]
3.
P1: Need [7, 4, 3] > Available [7, 3, 2]
· P1 cannot be satisfied now.
New Attempts:
1.
P3: Need [6, 0, 0] ≤ Available [7, 3, 2]
· P3 can be satisfied.
· New Available = [7 + 3, 3 + 0, 2 + 2] = [10, 3, 4]
2.
P1: Need [7, 4, 3] ≤ Available [10, 3, 4]
· P1 can now be satisfied.
· New Available = [10 + 0, 3 + 1, 4 + 0] = [10, 4, 4]
Thus,
one safe sequence is:
P4, P2, P3, P1.
Let's re-evaluate the possibility of other sequences from the original state:
1.
P2: Need [1, 2, 2] ≤ Available [3, 2, 1]
· P2 can be satisfied.
· New Available = [3 + 2, 2 + 0, 1 + 0] = [5, 2, 1]
2.
P4: Need [0, 1, 1] ≤ Available [5, 2, 1]
· P4 can be satisfied.
· New Available = [5 + 2, 2 + 1, 1 + 1] = [7, 3, 2]
3.
P3: Need [6, 0, 0] ≤ Available [7, 3, 2]
· P3 can be satisfied.
· New Available = [7 + 3, 3 + 0, 2 + 2] = [10, 3, 4]
4.
P1: Need [7, 4, 3] ≤ Available [10, 3, 4]
· P1 can be satisfied.
· New Available = [10 + 0, 3 + 1, 4 + 0] = [10, 4, 4]
Thus,
another safe sequence is:
P2, P4, P3, P1.
Checking permutations, if we look at attempting
P3 first, P1 will always remain dependent unless P2 or P4's releases happen.
3.
P3: Need [6, 0, 0] ≤ Available [3, 2, 1]
· P3 cannot be satisfied directly with Available.
Thus, the correct number of safe sequences when using all permissible permutations and using Banker's Algorithm, the total number of possible safe sequences is
2.