Gate Questions with topics discussion|Process Synchronization-part3

Опубликовано: 18 Октябрь 2024
на канале: TechGuiders
395
5

Gate Questions with topics discussion|Process Synchronization-part3
Gate 2015-Question65
Two processes X and Y need to access a critical section. Consider the following synchronization construct used by both the processes.
Here varP and varQ are shared variables and both are initialized to false. Which one of the following statements is true?

Gate 207-Question 58
Two processes, P1 and P2, need to access a critical section of code. Consider the following synchronization construct used by the processes:
while (true) {
wants1 = true;
while (wants2 == true);
wants1 = false;
}
while (true) {
wants2 = true;
while (wants1 == true);
wants2=false;
}
Here, wants1 and wants2 are shared variables, which are initialized to false.
Which one of the following statements is TRUE about the construct?

Gate 2001-Question 2 .2Consider Peterson's algorithm for mutual exclusion between two concurrent processes i and j. The program executed by process is shown below.
repeat
flag[i] = true;
turn = j;
while (P) do no-op;
CS
Flag[i] = false;
Perform other non-critical section actions.
Until false;
For the program to guarantee mutual exclusion, the predicate P in the while loop should be
#gatequestionsoperatingsystem
#gatequestionsprocesssynchronization
#gatequestionstwoprocesssolutions
#algorithm1twoprocesssolution
#algorithm2twoprocesssolution
#petersonsalgorithm
#petersonsalgorithmgate