GATE / CS ARCHIVE

GATE CSE 1998 / QUESTION 1.31

Net semaphore updates

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

GATE 1998, Q1.31 1 mark · MCQ
Report issue

Synchronization & Concurrency

Question 1.31, GATE 1998: A counting semaphore starts at 10. Six completed P(wait) and four completed V(signal) operations occur. Find the final value among 0, 8, 10, 12.
Tap to enlarge
Your answer
Answer & solution

Answer: B: 8 (no official key was published)

Each completed wait consumes one available unit, decreasing the count by 1. Each signal adds one unit. Thus the net change is−6+4=−2, and the final count is 10−2=8. Because all six waits are stated to complete and the initial count is sufficient even before signals, no blocking ambiguity affects this arithmetic. Hence B; counting only the signals would incorrectly increase the initial value.

Original paper, page 3