Recent Articles



































Test-and-set



         


In computer science, the test-and-set CPU instruction is a special instruction that atomically tests and modifies the contents of a memory location. It is used to implement semaphores 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.





  View Live Article   This article is from Wikipedia. All text is available under the terms of the GNU Free Documentation License