CS FundamentalsHardIBM · Deloitte pattern

How many of the following statements about semaphores and mutexes are correct? 1. A binary semaphore can be used to achieve mutual exclusion. 2. A mutex can be released only by the thread that acquired it, whereas a semaphore can be signalled by any thread. 3. A counting semaphore initialised to 3 lets at most 3 threads into the guarded section at once. 4. wait() and signal() must themselves execute atomically.

  1. A. Only one
  2. B. Only two
  3. C. Only three
  4. D. All four

Correct answer: D. All four

All four hold. Ownership (2) is the key difference that makes a mutex suitable for locking and a semaphore suitable for signalling between threads; atomicity (4) is what makes either work.

More Operating Systems questions

Exams that ask this topic