The Implementation of Semaphores
Most contemporary computer architectures offer hardware support for process synchronization in the form of specialized machine instructions. The test-and-set instruction (TS) copies a variable into a register and sets the variable to zero in one indivisible machine cycle. Test-and-set has the form TS(R, x) where R is a register and x is a memory location and performs…