title: What is the difference in logic and performance between LOCK XCHG and MOV+MFENCE?
body: <p>What is the difference in logic and performance between x86-instructions <code>LOCK XCHG</code> and <code>MOV+MFENCE</code> for doing a sequential-consistency store.</p>
  
  <p>(We ignore the load result of the <code>XCHG</code>; compilers other than gcc use it for the store + memory barrier effect.)</p>
  
  <p>Is it true, that for sequential consistency, during the execution of an atomic operation: <code>LOCK XCHG</code> locks only a single cache-line, and vice versa <code>MOV+MFENCE</code> locks whole cache-L3(LLC)?</p>