Concurrency and Synchronization questions

Q34

GATE CS 2020 CSConcurrency and SynchronizationMCQ2 marks−2/3 if wrong
Each of a set of nn processes executes the following code using two semaphores a and b initialized to 1 and 0, respectively. Assume that count is a shared variable initialized to 0 and not used in CODE SECTION P.
CODE SECTION P

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

CODE SECTION Q
What does the code achieve?
Show answer without attempting

Answer: A

0/10 correct0 marks

Related topics in Operating Systems