Open In App

GATE | GATE-CS-2016 (Set 1) | Question 60

Consider the following proposed solution for the critical section problem. There are n processes: P0 …Pn−1. In the code, function pmax returns an integer not smaller than any of its arguments. For all i, t[i] is initialized to zero.

Which one of the following is TRUE about the above solution?
(A) At most one process can be in the critical section at any time
(B) The bounded wait condition is satisfied
(C) The progress condition is satisfied
(D) It cannot cause a deadlock

Answer: (A)
Explanation:

Mutual exclusion  is satisfied:
All other processes j started before i must have value (i.e. t[j]) 
less than the value of process i (i.e. t[i])  as function pMax() 
return a integer not smaller  than any of its arguments. So if anyone 
out of the processes j have positive value will be executing in its 
critical section as long as the condition t[j] > 0 && t[j] 
Deadlock and progress are  not satisfied:  
while (t[j] != 0 && t[j] 
Bounded waiting is also not satisfied: 
In this case both deadlock and bounded waiting to be arising from the same 
reason as if t[j] == t[i] is possible then starvation is possible means 
infinite waiting.

This explanation has been contributed by Dheerendra Singh.
Quiz of this Question

Article Tags :