GATE CS 2023 | Question 38
Operating Systems › Process Synchronization · MCQ · 2 marks · Answer: C
- Question 38Operating Systemsmcq2 marksincr/decr each do wait(s); X=X±1; signal(s). 5 threads call incr, 3 call decr, initial X=10. I-1: s binary semaphore =1. I-2: s counting semaphore =2. are final X values. Which gives the MINIMUM possible ?
- A.15, 7
- B.7, 7
- C.12, 7✓
- D.12, 8
Answer: C
Solution
Answer: (C) 12, 7 5 threads call incr (X+1), 3 call decr (X-1); initial X=10. - I-1 (binary semaphore = 1): mutual exclusion holds, so every update applies: (fixed; its minimum is 12). - I-2 (counting semaphore = 2): up to two threads are in the critical section at once, so increments can be lost through races. Minimizing by losing increments while keeping decrements, the smallest reachable value is . Hence . - A.
More GATE PYQ on Process Synchronization
All GATE CS Operating Systems PYQ →Attempt GATE CS 2023 in real GATE exam mode
Full paper with a timer, the GATE interface and a topic-wise analysis — free.
Create free account →