Gate Questions with topics discussion-Process Synchronization part2

Опубликовано: 20 Октябрь 2024
на канале: TechGuiders
465
6

Process Synchronization in Operating System Gate Questions and topics discussion|part1

Question1:Gate 2016-48
Consider the following two-process synchronization solution.
PROCESS 0 Entry: loop while (turn == 1); (critical section)Exit: turn = 1;Process 1 Entry: loop while (turn == 0); (critical section)Exit turn = 0;
The shared variable turn is initialized to zero. Which one of the following is TRUE?
This is a correct two- process synchronization solution.
This solution violates mutual exclusion requirement.
This solution violates progress requirement.
This solution violates bounded wait requirement.
Question2:Gate 2010
Consider the methods used by processes P1 and P2 for accessing their critical sections whenever needed, as given below. The initial values of shared boolean variables S1 and S2 are randomly assigned.

Method Used by P1
while (S1 == S2) ;
Critica1 Section
S1 = S2;

Method Used by P2
while (S1 != S2) ;
Critica1 Section
S2 = not (S1);


#gatequestionsprocesssynchronization
#gatequestionsoperatingsystem
#gatequestionssemaphore
#gatequestionsalgorithm1
#algorithm1twoprocesssolution
#algorithm2twoprocesssolution