Correct Answer: D. Impose a global order on forks and acquire them in that order
Explanation:
Resource ordering prevents a cycle because all philosophers request forks according to one consistent order.
Without a cycle in resource requests, circular wait cannot occur.
Correct Answer: A. Synchronizing one service provider with a limited waiting area and arriving customers
Explanation:
The sleeping-barber problem represents customers arriving, waiting when seats exist, or leaving when full.
The barber sleeps when no customer is present and must be awakened safely.
Correct Answer: B. No participating thread passes the barrier until all required threads have arrived
Explanation:
A barrier synchronizes phases by holding early arrivals until the complete group reaches the same point.
A reusable barrier resets so the group can synchronize again in later phases.
Correct Answer: C. The number of unused buffer slots
Explanation:
The empty semaphore prevents a producer from inserting when no free slot remains.
It is decremented before insertion and incremented after a consumer removes an item.
Correct Answer: D. The number of occupied buffer slots containing items
Explanation:
The full semaphore prevents a consumer from removing an item when the buffer is empty.
A producer increments it after placing a new item in the buffer.
Correct Answer: A. No reader should wait unless a writer already has permission to use the shared object
Explanation:
The first readers-writers formulation favors readers when no writer is currently active.
Multiple readers may enter together, which can delay waiting writers.
A continuous arrival of readers can repeatedly postpone a waiting writer.
Fair or writer-priority policies are used when bounded waiting for writers is required.
Correct Answer: C. Each philosopher may hold one fork while waiting in a circular chain for the other
Explanation:
The simultaneous left-fork acquisition creates hold-and-wait and circular-wait conditions.
No philosopher can obtain the second fork, so none releases the first.
A binary semaphore uses two logical states and can provide mutual exclusion or event signaling.
A counting semaphore represents multiple available units of a resource.
A counting semaphore maintains a nonnegative count corresponding to available resource instances.
Each acquisition decrements the count, and each release increments it.