I am reading Vol 3a of the Intel Developer manuals:
and on page 245 it implies only XCHG
instruction has automatic bus locking. Instructions such as XADD
and CMPXCHG
do not automatically lock the system bus and to do so you need to prefix with LOCK
. To me, this suggests the instructions alone are not atomic across multiple CPU cores.
So what is the purpose of these instructions, if they aren't atomic?
Before I read the manual I expected these instructions would inherently be atomic at the CPU level. I thought that was the reason for combining the "compare" and "set" functions.
EDIT:
The reason could be to enforce atomicity on a single CPU core??