title: Unordered read-write safety without locks
body: <p>x86 32/64bit architecture</p>
  
  <p>If there is a piece of data under some aligned address and we perform reading and writing on it simultaneously -- from two distinct CPUs -- but we don't care about the order of those. Is it safe to do it without locks and fences?</p>
  
  <p>Specifically, would doing the following instructions simultaneously not case appearance of something like 111...000 in EAX?</p>
  
  <pre><code>MOV DWORD PTR [addr], 0xffffffff
  
  MOV DWORD PTR [addr], 0
  
  MOV EAX, DWORD PTR [addr]
  </code></pre>
  
  <p>where <code>addr == 4n</code>.</p>
  
  <p>If not, what about unaligned <code>addr</code>? </p>
  
  <p>Also what about switching to 64bits?</p>