why do we need a lock prefix before CMPXCHG in intel architecture. see link http://courses.engr.illinois.edu/ece390/archive/spr2002/books/labmanual/inst-ref-cmpxchg.html
that Iβm not sure what the consequences are if not to use a lock. because between loading a value in eax and LOCK CMPXCHG exception, the value can be changed regardless of the lock prefix, because the loading value in eax and LOCK CMPXCHG are two instructions.
To say if I do not use CMPXCHG, the worst thing that can happen is that I need to spin again.
java multithreading parallel-processing distributed-computing
veritas
source share