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

Discussion

A counting semaphore is initialised to 3 to guard a pool of three buffers. After two successful takes its count is

  • A.0
  • B.1
  • C.3
  • D.2

Answer: B

Each take decrements the count, so two takes leave one buffer available and a third take would succeed before the fourth blocked. Initialising such a semaphore to the number of resources rather than to zero is the distinction between guarding a pool and signalling an event.

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

Post your comment

Please log in or register to post a comment.