title: Is a memory barrier an instruction that the CPU executes, or is it just a marker?
body: <p>I am trying to understand what is a memory barrier exactly.
  Based on what I know so far, a memory barrier (for example: <code>mfence</code>) is used to prevent the re-ordering of instructions from before to after and from after to before the memory barrier.</p>
  
  <p>This is an example of a memory barrier in use:</p>
  
  <pre><code>instruction 1
  instruction 2
  instruction 3
  mfence
  instruction 4
  instruction 5
  instruction 6
  </code></pre>
  
  <p>Now my question is: Is the <code>mfence</code> instruction just a marker telling the CPU in what order to execute the instructions? Or is it an instruction that the CPU actually executes like it executes other instructions (for example: <code>mov</code>).</p>