The Test-and-set reference article from the English Wikipedia on 24-Apr-2004
(provided by Fixed Reference: snapshots of Wikipedia from wikipedia.org)

Test-and-set

Time you got around to sponsoring a child
In computer science, the test-and-set CPU instruction is a special instruction that atomicallyally tests and modifies the contents of a memory location. It is used to implement semaphoress in multiprocessor systems.

In uniprocessor systems, it is sufficient to disable interrupts before accessing a semaphore.

However, in multiprocessor systems, it is impossible and undesirable to disable interrupts on all processors at the same time; and even with interrupts disabled, two or more processors could be attempting to access the same semaphore's memory at the same time. The test-and-set instruction, allows any processor to atomically test and modify a memory location, preventing such multiple processor collisions. The processor should still disable its interrupts, as in a uniprocessor system, before executing a test-and-set, to prevent a deadlock if another process running on this processor also accesses that semaphore.