Information AboutCompare-and-swap |
| CATEGORIES ABOUT COMPARE-AND-SWAP | |
| concurrency control | |
| computer arithmetic | |
|
CAS is used to implement Semaphore s in Multiprocessor systems. It is also used to implement Lock-free And Wait-free Algorithms in multiprocessor systems, something that Maurice Herlihy (1993) proved cannot be done with only read, write, and Test-and-set . In uniprocessor systems, it is sufficient to disable Interrupt s before accessing a semaphore. However, in multiprocessor systems, it is impossible and undesirable to disable interrupts on all processors at the same time. Even with interrupts disabled, two or more processors could be attempting to access the same semaphore's memory at the same time. The compare-and-swap instruction allows any processor to atomically test and modify a memory location, preventing such multiple processor collisions. SEE ALSO EXTERNAL LINKS
|
|
|