Atomic Read-Modify-Write

Back to Compare-and-Swap (CAS)

CAS atomically reads a memory location, compares it with an expected value, and writes a new value only if the comparison succeeds — all in one indivisible hardware operation. This is the primitive that enables building all lock-free algorithms.

concurrency lock-free cas atomic