Semaphore Kernel Objects
Semaphore kernel objects are used for resource counting. They contain a usage count, as all kernel objects do, but they also contain two additional signed 32-bit values: a maximum resource count and a current resource count. The maximum resource count identifies the maximum number of resources that the semaphore can control; the current resource count indicates the number of these resources that are currently available.
To put this in perspective, let’s see how an application might use semaphores. Let’s say that I’m developing a server process in which I have allocated a buffer that can hold client requests. I’ve hard-coded the size of the buffer so that it can hold a maximum of five client requests at a time. If a new ...
Get Windows® via C/C++, Fifth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.