GATE CS 2016, set 1 · Question 60 · Operating System · Multiple choice (MCQ) · 2 marks · −2/3 for a wrong answer
Consider the following proposed solution for the critical section problem. There are n processes: P₀ … Pₙ₋₁. In the code, function pmax returns an integer not smaller than any of its arguments. For all i, t[i] is initialized to zero.
Code for Pᵢ:
do { c[i]=1; t[i] = pmax(t[0],...,t[n-1])+1; c[i]=0; for every j ≠ i in {0,...,n-1} { while (c[j]); while (t[j] != 0 && t[j]<=t[i]); } Critical Section; t[i]=0; Remainder Section; } while (true);
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
Answer (A)
Answer from the official GATE CS 2016 answer key.
The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes