ISRO Scientist/Engineer CSE 2023Operating Systems › Process Synchronization
ISRO Scientist/Engineer CSE 2023 PYQ: In a producer-consumer scenario also known as Bounded-Buffer Problem, what would be the most appropriate…
In a producer-consumer scenario also known as Bounded-Buffer Problem, what would be the most appropriate synchronization primitive to ensure that the consumer waits when the buffer is empty?
- ASpinlock
- BMutex lock
- CSemaphoreCorrect answer
- DMonitors
Answer
(C) Semaphore
Approach
The bounded-buffer problem requires a mechanism that can both block a process and track the number of available items. A counting semaphore naturally represents the count of empty/full slots and blocks the consumer when the count is zero, which is exactly the required behavior.
Reviewed by ISRO IQ Editorial Team.