Counting Semaphores:
Counting semaphores are used when a resource is to be allocated from a pool of
identical resources. The semaphores initialized the number of resources in the
pool. When a resource is allocated and p operation is executed, it decrement
semaphores by 1.
When v operation is executed, it increments semaphores by 1. It
indicates that the resource has been released and is available for another
process. If p operation is called when the semaphore has been decremented to
zero, the process has to wait until a resource is released by V operation.
|