What problems might arise when sharing an int between two threads?
<p>Two threads accesses a shared int, x. What problems can arise from instruction reordering etc.</p>

<p>Thread 1:</p>

<pre><code>x = 1;
</code></pre>

<p>Thread 2:</p>

<pre><code>obj.f(x);
</code></pre>

<p>What would change if x is declarared volatile?<br>
What would change if Thread 1 and Thread 2 runs on different cores?</p>
