GATE - 2018 | OS | In a system, there are three types of resources: E, F and G. Four

GATE - 2018 | OS | In a system, there are three types of resources: E, F and G. Four
Posted on 08-02-2022

GATE - 2018 [Operating System]

Question:

In a system, there are three types of resources: E, F and G. Four processes P0, P1, P2 and P3 execute concurrently. At the outset, the processes have declared their maximum resource requirements using a matrix named Max as given below. For example, Max[P2, F] is the maximum number of instances of F that P2 would require. The number of instances of the resources allocated to the various processes at any given state is given by a matrix named Allocation.

Consider a state of the system with the Allocation matrix as shown below, and in which 3 instances of E and 3 instances of F are the only resources available.

In a system, there are three types of resources: E, F and G. Four processes P0, P1, P2 and P3 execute concurrently. At the outset, the processes have declared their maximum resource requirements using a matrix named Max as given below. For example, Max[P2, F] is the maximum number of instances of F that P2 would require. The number of instances of the resources allocated to the various processes at any given state is given by a matrix named Allocation.  Consider a state of the system with the Allocation matrix as shown below, and in which 3 instances of E and 3 instances of F are the only resources available.

From the perspective of deadlock avoidance, which one of the following is true?

A

The system is in safe state.

B

The system is not in safe state, but would be safe if one more instance of E were available.

C

The system is not in safe state, but would be safe if one more instance of F were available.

D

The system is not in safe state, but would be safe if one more instance of G were available.

      

Solution:

Option (A) is Correct

⟨E, F, G⟩ = ⟨3, 3, 0⟩

Safe sequence: ⟨P0, P2, P1, P3⟩ P0: P0 can be allotted ⟨3,3,0⟩. After completion Available = ⟨4,3,1⟩ P2: P2 can be allotted ⟨0,3,0⟩. After completion: Available = ⟨5,3,4⟩ P1: P1 can be allotted ⟨1,0,2⟩. After completion: Available = ⟨6,4,6⟩ P3: P3 can be allotted ⟨3,4,1⟩. After completion: Available = ⟨8,4,6⟩
Safe sequence:
⟨P0, P2, P1, P3
P0: P0 can be allotted ⟨3,3,0⟩.
After completion Available = ⟨4,3,1⟩
P2: P2 can be allotted ⟨0,3,0⟩.
After completion: Available = ⟨5,3,4⟩
P1: P1 can be allotted ⟨1,0,2⟩.
After completion: Available = ⟨6,4,6⟩
P3: P3 can be allotted ⟨3,4,1⟩.
After completion: Available = ⟨8,4,6⟩

Thank You

Download App for Free PDF Download

GovtVacancy.Net Android App: Download

government vacancy govt job sarkari naukri android application google play store https://play.google.com/store/apps/details?id=xyz.appmaker.juptmh