title: Stuck on a Concurrent programming example, in pseudocode(atomic actions/fine-grained atomicity)
body: <p>My <a href="https://rads.stackoverflow.com/amzn/click/com/0201357526" rel="nofollow noreferrer" rel="nofollow noreferrer">book</a> presents a simple example which I'm a bit confused about:</p>
  
  <p>It says, "consider the following program, and assume that the fine-grained atomic actions are reading and writing the variables:"</p>
  
  <pre><code>int y = 0, z = 0;
  co x = y+z; // y=1; z=2; oc;
  </code></pre>
  
  <p>"If <code>x = y + z</code> is implemented by loading a register with y and then adding z to it, the final value of x can be 0,1,2, or 3. "</p>
  
  <p>2? How does 2 work? </p>
  
  <p>Note: co starts a concurrent process and // denote parallel-running statements</p>