Compare-and-Swap (CAS)
← Back to Lock-Free & Wait-Free Programming
An atomic hardware instruction that compares a memory location with an expected value and, only if they match, atomically replaces it with a new value. CAS is the fundamental building block of all lock-free data structures and algorithms.