GATEverse Practice, past papers & mock tests
GATE 2013 · session-1
Operating SystemsProcess Management-IImediumMCQ2 marks
A shared variable x, initialized to zero, is operated on by four concurrent processes W,X,Y,Z as follows. Each of W and X reads x from memory, increments by one, stores it to memory, and then terminates. Each of Y and Z reads x from memory, decrements by two, stores it to memory, and then terminates. Each process before reading x invokes the P operation (wait) on a counting semaphore S and invokes V (signal) on S after storing x to memory. Semaphore S is initialized to two. What is the maximum possible value of x after all processes complete execution?
Save your progress

Related Operating Systems PYQs