ISRO Computer Science (CSE) 2023 - Question 53

All ISRO Computer Science (CSE) papers | ISRO Computer Science (CSE) 2023

Topic: Operating Systems

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?

  • A. Spinlock
  • B. Mutex lock
  • C. Semaphore
  • D. Monitors

Answer: C. Semaphore

Explanation: Counting semaphores are typically used to solve the bounded-buffer problem. Specifically, a semaphore initialized to 0 tracks the number of 'full' slots. The consumer performs a wait/down operation on it, inherently ensuring the consumer blocks when the buffer is completely empty.

| | All questions of ISRO Computer Science (CSE) 2023