Reputation: 570
re-read the JMM, find that there is one sentence I do not understand:
We consider here only variables that are readable and writable as an atomic unit -- that is, no bit fields, unaligned accesses, or accesses larger than word sizes available on a platform.
Anyone can explain the cases shown above which the words are bold.
Upvotes: 4
Views: 96
Reputation: 16142
On some architectures, the processor can do in a single command multiple memory accesses:
In these cases, an operation will need to cross several memory accesses, thus tehre is potential for race conditions, thus no atomicity guarantees.
Upvotes: 2