Question discussion

In a producer-consumer problem solved using semaphores empty, full, and binary semaphore mutex, what would happen if both the producer and…

512Medium DSSSB TGT Computer Science 0 replies 1 views
0
In a producer-consumer problem solved using semaphores empty, full, and binary semaphore mutex, what would happen if both the producer and consumer acquired wait(mutex) before wait(empty)/wait(full) respectively (instead of after)?
  • ANo difference in behaviour
  • BIt could lead to a deadlock, e.g. when the buffer is full and the consumer is waiting for mutex held by a blocked producer
  • CIt would make the solution faster
  • DIt would eliminate the need for the mutex semaphore
Correct answer: B

Discussion 0

Nobody has replied yet. Start the discussion!