Compare and swap instruction
This executes as the following, but is atomic!
int CAS(int *ptr, int old, int new) { int tmp = *ptr; if (*ptr == old) *ptr = new return tmp; }