title: Does Java volatile read flush writes, and does volatile write update reads
body: <p>I understand read-acquire(does not reorder with subsequent read/write operations after it), and write-release(does not reorder with read/write operations preceding it).
  My q is:-</p>
  
  <ol>
  <li>In case of read-acquire, do the writes preceding it get flushed?</li>
  <li>In case of write-release, do the previous reads get updated?</li>
  </ol>
  
  <p>Also, is read-acquire same as volatile read, and write release same as volatile write in Java?</p>
  
  <p>Why this is important is that, let's take case of write-release.. </p>
  
  <pre><code>y = x; // a read.. let's say x is 1 at this point
  System.out.println(y);// 1 printed
  //or you can also consider System.out.println(x);
  write_release_barrier();
  //somewhere here, some thread sets x = 2
  ready = true;// this is volatile
  System.out.println(y);// or maybe, println(x).. what will be printed?
  </code></pre>
  
  <p>At this point, is x 2 or 1?
  Here, consider ready to be volatile.
  I understand that all stores before volatile will first be made visible.. and then only the volatile will be made visible. Thanks.</p>
  
  <p>Ref:- <a href="http://preshing.com/20120913/acquire-and-release-semantics/" rel="noreferrer">http://preshing.com/20120913/acquire-and-release-semantics/</a></p>