Skip to content

Beta · Data may be lost.Your data may be reset or lost.

GateBrew
← GATE CSE 2020
Questions

Q34

MCQ2 marks, −0.67Operating systems

Each of a set of nn processes executes the following code using two semaphores aa and bb initialized to 11 and 00, respectively. Assume that count\text{count} is a shared variable initialized to 00 and not used in CODE SECTION P. CODE SECTION P\begin{array}{|c|} \hline \textbf{CODE SECTION P} \\ \hline \end{array}

wait(a); count=count+1;
if (count==n) signal (b);
signal (a); wait (b) ; signal (b);

CODE SECTION Q\begin{array}{|c|} \hline \textbf{CODE SECTION Q} \\ \hline \end{array} What does the code achieve?

Sign in to save attempts.

Solutions and discussion are hidden while you attempt this question. They open once you check or show the answer.