what is value of x for load and store

Posted by Kevinniceguy on Stack Overflow See other posts from Stack Overflow or by Kevinniceguy
Published on 2010-04-27T20:55:01Z Indexed on 2010/04/30 6:07 UTC
Read the original article Hit count: 230

Filed under:
|
|
|
|

This is some challenge

On a single processor system, in which load and store are assumed to be atomic, what are all the possible values for x after both threads have completed in the following execution, assuming that x is initialised to O? Hint: you need to consider how this code might be compiled into machine language.

for (int i = 0; i < 5; i++) : x = x + 1;

for (int j = 0; j < 5; j++) : x = x + 1;

© Stack Overflow or respective owner

Related posts about load

Related posts about store