GATE - 2005 | OS | Two concurrent processes P1 and P2 use four shared resources R1

GATE - 2005 | OS | Two concurrent processes P1 and P2 use four shared resources R1
Posted on 19-02-2022

GATE - 2005 [Operating System]

Question:

Two concurrent processes P1 and P2 use four shared resources R1, R2, R3 and R4, as shown below.

P1

P2

Compute: Use R1; Use R2; Use R3; Use R4;

Compute; Use R1; Use R2; Use R3;. Use R4;

Both processes are started at the same time, and each resource can be accessed by only one process at a time The following scheduling constraints exist between the access of resources by the processes:

  • P2 must complete use of R1 before P1 gets access to R1
  • P1 must complete use of R2 before P2 gets access to R2.
  • P2 must complete use of R3 before P1 gets access to R3.
  • P1 must complete use of R4 before P2 gets access to R4.

There are no other scheduling constraints between the processes. If only binary semaphores are used to enforce the above scheduling constraints, what is the minimum number of binary semaphores needed?

A

1

B

2

C

3

D

4

   

Solution:

Option (B) is Correct.

It needs two semaphores such as X=0; Y=0

wo concurrent processes P1 and P2 use four shared resources R1, R2, R3 and R4, as shown below. P1	P2 Compute: Use R1; Use R2; Use R3; Use R4;	Compute; Use R1; Use R2; Use R3;. Use R4;Both processes are started at the same time, and each resource can be accessed by only one process at a time The following scheduling constraints exist between the access of resources by the processes: P2 must complete use of R1 before P1 gets access to R1 P1 must complete use of R2 before P2 gets access to R2. P2 must complete use of R3 before P1 gets access to R3. P1 must complete use of R4 before P2 gets access to R4. There are no other scheduling constraints between the processes. If only binary semaphores are used to enforce the above scheduling constraints, what is the minimum number of binary semaphores needed?

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