educative.io

Multiple thread updating value during CAS Operation

CAS instruction says I have seen and expect the variable’s value to be A, if that is still true, update the variable to the new value B, otherwise fail my request and let me know When a thread is updating variable value to new value B, can this happen that another thread can context switch and update the variable value to something else say C.