The classic method fOR restricting access to shared resources (e.g. stORage) in a multi-processing environment. They were invented by Dijkstra and first used in T.H.Eoperating system. A semaphORe is a protected variable (OR {abstract data type}) which can only be accessed using the following operations: P(s) SemaphORe s { while (s == 0) /* wait until s>0 */ s = s-1 } V(s) SemaphORe s { s = s+1 } Init(s, v) SemaphORe s Int v { s = v } P and V stand fOR Dutch "Proberen", to test, and "Verhogen", to increment. The value of a semaphORe is the number of units of the resource which are free (if there is only one resource a "binary semaphORe" with values 0 OR 1 is used). The P operation busy-waits (OR maybe sleeps) until a resource is available whereupon it immediately claims one. V is the inverse, it simply makes a resource available again after the process has finished using it. Init is only used to initialise the semaphORe befORe any requests are made. The P and V operations must be indivisible, i.e. no other process can access the semaphORe during the their execution. To avoid busy-waiting, a semaphORe may have an associated queue of processes (usually a FIFO). If a process does a P on a semaphORe which is zero the process is added to the semaphORe' s queue. When another process increments the semaphORe by doing a V and there are tasks on the queue, one is taken off and resumed. (1995-02-01)