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

Discussion

A semaphore used for signalling should be initialised to

  • A.the number of tasks that will wait on it
  • B.the number of events expected over the system's life
  • C.0, so that the first wait blocks until an event occurs
  • D.1, so that the first wait returns immediately

Answer: C

Starting at zero means the waiting task blocks until something actually happens, which is what signalling means. Starting at one is right for a lock, where the resource is free to begin with, and confusing the two initialisations gives a first iteration that runs on no data.

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

Post your comment

Please log in or register to post a comment.