On a 64-bit machineis it safe to say that assignment to a 64-bit integer is atomic? In other words:
If 1 thread does this (C code):
unsigned __int64 a;
a = 1;
a = 0x200000000;
and another thread reads the value, it will read either 1 or 0x200000000, but never 0x200000001;
Does the address alignment of the variable matter? (i.e must that variable "a" be aligned to an 8 byte boundary?)
Is this the same on x64 versus Itanium platforms?
Thanks for any comments or pointers to a reference on this subject.
Thanks for the excellent reply, although I have one follow up question.
I gather from limited research thatx64 and Itanium chips support MESI. However, I'm still trying to understand data alignment on Itanium systems. I read a good article on data alignment (http://msdn2.microsoft.com/en-us/library/aa290049.aspx) that indicates the Itanium does not provide hardware support for storing/fetching non-aligned 64-bit values. From my understanding the operating system must fixup the unaligned memory access by issuing 2 separate accesses. In this case, canan unaligned access that straddles a cache line boundary cause the 2 adjacent cache lines to become modified at different points in time?I would assume thattwoadjacent cache lines musttransition to the "modified" state at the exact same to to ensure that anotherprocessor's thread reads a consistent 64-bit value. Or is there another mechanism that ensures a consistent value?
Thanks again for any comments.