Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Execution Order

Assignment

Assigned Value

Notes

1.

a = 10;

10

 

2.

b = 20;

20

 

3.

r1 = b;

0

Reads initial value of b, that is 0

4.

r2 = a;

0

Reads initial value of a, that is 0

In this ordering, a r1 and b r2 read the values of future write operations because reads are permitted to see future writesoriginal values of the variables a and b even though they might be expected to see the updated values.

Execution Order

Statement

Assigned Value

Notes

1.

r1 = b;

20

Reads later value (in step 4.) of write, that is 20

2.

r2 = a;

10

Reads later value (in step 3.) of write, that is 10

3.

a = 10;

10

 

4.

b = 20;

20

 

In this ordering, a r1 and b r2 read the values of a and b written from step 3 and 4, before the steps are executed. Such counter-intuitive behavior necessitates the sequential consistency property.

...