title: memory_order_relaxed load vs volatile load
body: <p>What is the difference between reading the value of an <a href="http://en.cppreference.com/w/cpp/atomic/atomic" rel="nofollow"><code>atomic_uint</code></a> with memory_order_relaxed, and reading the value of a <code>volatile unsigned int</code> (assuming the volatile operations are atomic)?</p>
  
  <p>Specifically, let's define:</p>
  
  <p><strong>Solution 1</strong></p>
  
  <ol>
  <li>The "writer" thread writes to an <code>atomic_uint</code> (with any memory order qualifier, from memory_order_relaxed to memory_order_seq_cst)</li>
  <li>The "reader" thread does an atomic relaxed read on the same <code>atomic_uint</code></li>
  </ol>
  
  <p><strong>Solution 2</strong></p>
  
  <ol>
  <li>The "writer" thread writes to a <code>volatile unsigned int</code></li>
  <li>The "reader" thread reads that value</li>
  </ol>
  
  <p>As-is, I know that both cases do not offer any guarantees regarding the ability of the reader to read the value written by the writer. What I'm trying to understand is the difference between the volatile read, and the relaxed atomic read. What does one provide that the other doesn't, when considering read-after-write consistency?</p>
  
  <p>The only difference I see is:</p>
  
  <ul>
  <li>volatile operations cannot be re-ordered between them, while the atomic load can be re-ordered with other atomic operations</li>
  </ul>
  
  <p>Is there something else?</p>