recall

← recall

compare-and-swap term

atomic 'set X to B only if currently A'

CPU instruction that reads + conditionally writes atomically. Foundation of lock-free data structures and optimistic concurrency. Returns whether the swap happened.

aliases: CAS, compare-and-set

topics: concurrency, locks, internals

references: