GATE / CS ARCHIVE

GATE CSE 1997 / QUESTION 6.8

A process signals instead of waiting

Operating Systems · Synchronization & Concurrency · Full GATE CSE 1997 paper

GATE 1997, Q6.8 2 marks · MCQ
Report issue

Synchronization & Concurrency

Question 6.8, GATE 1997: Nine processes repeat P(mutex);critical section;V(mutex). A tenth replaces its initial P by V. What maximum number can be inside simultaneously?
Tap to enlarge
Your answer
Answer & solution

Answer: D: 10, none of 1, 2, 3 (no official key was published)

The faulty process never consumes a permit when entering and adds permits both before entering and after leaving. With a counting semaphore, it can complete enough loops to accumulate at least nine permits while the others wait to run. Then schedule all nine correct processes through P and pause each inside its critical section. Finally let the faulty process enter too: all ten are inside. Ten is the absolute upper bound because only ten processes exist, so it is attained. Even a saturating binary semaphore can be repeatedly reopened by the faulty process to admit more peers before they leave. Thus D.

Original paper, page 6