title: Volatile: why prevent compiler reorder code
body: <p>In java, with my knowledge, volatile variable make a thread reads/writes directly to main CPU (not in cache of each thread), so make its change visibles to other threads.</p>
  
  <p>The thing  I  don't know is : So, why this work (of volatile) can prevent compiler/CPU reorder statement of code.</p>
  
  <p>thanks :)</p>