title: How do I Understand Read Memory Barriers and Volatile
body: <p>Some languages provide a <code>volatile</code> modifier that is described as performing a "read memory barrier" prior to reading the memory that backs a variable.</p>
  
  <p>A read memory barrier is commonly described as a way to ensure that the CPU has performed the reads requested before the barrier before it performs a read requested after the barrier. However, using this definition, it would seem that a stale value could still be read. In other words, performing reads in a certain order does not seem to mean that the main memory or other CPUs must be consulted to ensure that subsequent values read actually reflect the latest in the system at the time of the read barrier or written subsequently after the read barrier.</p>
  
  <p>So, does volatile really guarantee that an up-to-date value is read or just (gasp!) that the values that are read are at least as up-to-date as the reads before the barrier? Or some other interpretation? What are the practical implications of this answer?</p>