counting semaphores in user space linux
I am told that linux supports counting semaphores which can be used to construct a binary semaphore. I am aware of the following system calls and their usage.
1. semget ---- to create semaphore set
2. semctl ---- to retrieve/change the semaphore values
3. semop ---- to acquire/release semaphores
however I do not understand how to use this as a counting semaphore. its pretty easy in VxWorks. Counting semaphores are used when we want to acquire and release the semaphore for a known umber of times.