Compare and swap

This is a common atomic instruction that exists on many CPU architectures. (x86: cmpxchg, SPARC: cas). It compares a value in memory with a value in a register, and if they match, overwrites the value in memory with a third value. If successful, the operation sets a status flag that can be used for branching. This can be used to efficiently implement spinlocks.

See also Atomic instruction and Spinlock.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.216.27.251