Consider the following proposed solution for the critical section problem.…

GATE · 2016 · CS · Set 1 · Computer Science & IT

Consider the following proposed solution for the critical section problem. There are nn processes: P0...Pn−1P_0 ...P_{n−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.

Code for PiP_i :

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?

  1. A.

    At most one process can be in the critical section at any time

  2. B.

    The bounded wait condition is satisfied

  3. C.

    The progress condition is satisfied

  4. D.

    It cannot cause a deadlock

Attempted by 178 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…