Counting semaphores

The counting semaphore that the CommonPoint application system provides is the traditional PV semaphore defined by Dijkstra, provided for programmers who are more comfortable with this style of thread synchronization. Like readers/writer lock style semaphores, counting semaphore are available in a local form, which can be used only within a task, and global form, which can be shared among tasks. Unlike readers/writer lock semaphores, counting semaphore can have no owner, and cannot recover when corrupted.

To use a counting semaphore, you decrement the semaphore's count before accessing the shared data it protects, and increment the count when you're finished with the data. If the semaphore's count is already zero when a thread attempts to decrement it, the thread blocks until another thread increments it.



[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker