title: difference between Memory Barriers and lock prefixed instruction
body: <p>In this article <a href="http://www.infoq.com/articles/memory_barriers_jvm_concurrency" rel="nofollow">Memory Barriers and JVM Concurrency</a>!, i was told volatile is implemented by different memory barriers instructions,while synchronized and atomic are implemented by lock prefixed  instruction. But i get bellow code in some other article:</p>
  
  <p>java code:</p>
  
  <p><code>volatile  Singleton instance = new Singleton();</code></p>
  
  <p>assembly instruction(x86):</p>
  
  <p><code>0x01a3de1d: movb $0x0,0x1104800(%esi);</code></p>
  
  <p><code>0x01a3de24: lock addl $0x0,(%esp);</code></p>
  
  <p>So which one is right?And what is the difference between  Memory Barriers and lock prefixed  instruction without considering  my poor english?</p>