Based on the railroad signpost, semaphores are also a software mechanism to regulate process synchronization
, proposed by Edsger W. Dijkstra
A semaphore is a software object. Its state is a nonnegative integer. Two methods are defined: decrement (known as P, for proberen te verlagen, "try to decrement"), and increment (known as V, for vrijgeven, "release").
A semaphore is shared by processes that wish to use a common resource. It is initialized with the number of processes that may use the resource concurrently. At any time, its state represents its availability.
Each participating process guards its critical sections of code, that is, the sections using the shared resource, by putting a P on the guarding semaphore in front of it, and a V at the end. A P blocks if the state is 0 (i.e. no more
processes may use the resource at this time).
Semaphores are implemented as part of SysV IPC. man semop.