Re: How to guarantee memory access orthogonality without atomics?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Thank you for commenting! So let me understand you:

X is 4 bytes wide. It's based at address 27. Y is also 4 bytes wide.
It's based at address 31. Cache lines happen to be 32 bytes long.
Processor 0 can write to X any time, and processor 1 can write to Y
anytime. Writing to Y causes an implicit read-modify-write to the line
containing X. But this doesn't matter because it's assumed under
C99/C11 that the processor will enforce the orthogonality of X and Y,
provided that their sizes are at least a multiple of whole bytes based
at whole-byte boundaries.

Is that correct?

"You can't have a data race if the threads don't access the same
objects." -- If you or anyone else has a spec subsection you can cite
for this, that would be most helpful. This is, in fact, the guarantee
I'm seeking, to the extent that objects and base addresses are
byte-granular.

On Fri, Apr 27, 2012 at 4:03 PM, Andrew Haley <aph@xxxxxxxxxx> wrote:

>
> I don't think it could.  You can't have a data race if the threads
> don't access the same objects.  The only way you'd be be able to
> implement C on a machine like this would be to allocate objects so
> that they didn't share cache lines.
>
> Andrew.



[Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

Add to Google