Semaphores were introduced by Dijkstra to give more elegant solutions to some of the concurrency problems in early operating systems work. A semaphore is a special type of integer variable that must be non-zero, and only has two operations available. These are shown in figures #fnsem1#358> and #fnsem2#359>.

Figure: Semaphores - Wait

Figure: Semaphores - Signal

It is essential to note that these operations have to be implemented in an uninterruptible way. i.e. they are indivisible. Semaphores may be used to protect critical regions of code simply since they make strong synchronisation. Unfortunately, they are not useful for distributed applications, since they are implemented by local variables and special instructions which are not available between different address spaces. However, since semaphores are well understood, many programming solutions are known using them. It is possible to show exact equivalence of semaphores to other mutual exclusion techniques.