The x86 LOCK
instruction allows a core to lock the system bus, so it can modify memory exclusively (or it allows the cache coherency protocol to achieve the same thing). However, Intel Developer Manual 3A doesn't state LOCK
flushes the store buffer.
In contrast, SFENCE
and MFENCE
prevent re-ordering and flush the store buffer?
So when do I need to use LOCK
and when SFENCE
/MFENCE
?
Does LOCK
concern atomicity of a single instruction, whereas SFENCE
/MFENCE
concern a series of instructions?