Skip to content

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

GateBrew
← GATE CSE 2013
Questions

Q34

MCQ2 marks, −0.67Operating systemsMedium

A shared variable xx, initialized to zero, is operated on by four concurrent processes W,X,Y,ZW, X, Y, Z as follows. Each of the processes WW and XX reads xx from memory, increments by one, stores it to memory, and then terminates. Each of the processes YY and ZZ reads xx from memory, decrements by two, stores it to memory, and then terminates. Each process before reading xx invokes the PP operation (i.e., wait) on a counting semaphore SS and invokes the VV operation (i.e., signal) on the semaphore SS after storing xx to memory. Semaphore SS is initialized to two. What is the maximum possible value of xx after all processes complete execution?

Sign in to save attempts.

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