The x86 lock prefix blocks all cores and allows atomicity. To implement this in other systems without LOCK, CMPXCHG loops or hard loops with retry logic are used that try to set the value of something to the expected value. As you can see, the second method is more harmful in most cases, because it just constantly cyclically tries to set the value (and continues to do this until it is done). For x86, the delay is minimal and can vary from stopping the command pipeline or flushing it, and then executing this command atomically (usually a couple of cycles), the second method cannot really be evaluated, since it depends on how many arguments are for the value that is needed change atomically. For a mutex, I believe that this is the value of the flag that should be received (make sure that the mutex is not received and constantly waits for the mutex to be captured, and then try using the atom to change the flag to receive it).
AFAIK IBM processors use the second method, since when working with the Linux kernel, I found that it uses the atomic increment function (perhaps this is only for older processors). X86 platform still uses
lock addl ...;
I admit that it has been about a year since I worked in this part of the kernel, so I could be wrong at some points.
Jesus ramos
source share