Machine-translated by Google. Questions are authored in English.
Top

Discussion

Put the steps of a producer-consumer exchange in order.

1. Producer signals the filled-slot semaphore   2. Producer waits on the free-slot semaphore   3. Consumer removes the item   4. Producer writes the item into the buffer

  • A.2, 4, 1, 3
  • B.4, 2, 1, 3
  • C.2, 1, 4, 3
  • D.1, 2, 4, 3

Answer: A

Space is secured first, then the item is written, then its presence is announced, and only then can the consumer take it. Signalling before writing is the classic error and lets the consumer read an item that is not yet there.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.