Compare-and-swap (CAS) atomically replaces the value of a location with a new value if and only if it still equals an expected value, and reports whether it did. A CAS loop reads the current value, computes a new one, and retries the CAS until no other thread has changed the location in between.
Quantitative Finance · Glosarium