GATE Computer Science (CS) 2016 Shift 1 Solved Paper
© examsiri.com
Question : 60 of 65
Marks:
+1,
-0
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.
Code for Pi:
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?
Code for Pi:
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?
Go to Question: