A Bounded Resource with a Counting Semaphore
ASSERT(FindFreeItem(&i));
void ReleaseEntry(int i) {
A semaphore for an N-way resource
is called a counting semaphore.
A caller that gets past a Down is guaranteed that a resource instance is reserved for it.
Note: the current value of the semaphore is the number of resource instances free to allocate.
But semaphores do not allow a thread to read this value directly. Why not?