GATE - 2016 | OS | Consider the following two-process synchronization solution.

GATE - 2016 | OS | Consider the following two-process synchronization solution.
Posted on 09-02-2022

GATE - 2016 [Operating System]

Question:

Consider the following two-process synchronization solution.

Process 0                                     Process 1

---------                                     ---------

Entry: loop while (turn == 1);             Entry: loop while (turn == 0);

  (critical section)                            (critical section)

Exit: turn = 1;                               Exit: turn = 0;

The shared variable turn is initialized to zero. Which one of the following is TRUE?

 

A

This is a correct two-process synchronization solution.

B

This solution violates mutual exclusion requirement.

C

This solution violates progress requirement.

D

This solution violates bounded wait requirement.

     

Soution:

Option (C) is Correct.

B) Mutual exclusion is satisfied because the value of the turn variable cannot be 0 and 1 at the same time.
So False.
C) Progress means if one process does not want to enter the critical section then it should not stop other processes to enter the critical section.
But we can see that if process 0 will not enter the critical section then the value of turn will not become 1 and process 1 will not be able to enter the critical section.
So progress is not satisfied. True.
D) Bounded waiting solution as there is a strict alteration.
So, False.

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