On 04/27/2012 09:49 AM, Leonard Plentz wrote:
> I'm trying to find the answer to this question about the way that C11
> (or for that matter, C99) does (not) guarantee the
> thread-orthogonality of various memory accesses in a cross-platform
> manner.
>
> Suppose I have integers (in the abstract sense, not necessarily
> (int)s) X and Y. They are both aligned on P-bit boundaries, such that
> the X appears exactly Q bits before Y. (P and Q are generally powers
> of 2 and equal, but not necessarily.)
>
> How do I find the minimum values of P and Q, in a cross-platform
> manner, such that accesses to X and Y will never affect one another
> due to a race?
>
> It may seem obvious that if X and Y are anything at least as large as
> a byte, then this will simply never happen. But I'm not so sure
> because:
>
> -- It's conceivable that someone could design a very efficient chip in
> which it was assumed that no variables belonging to different threads
> could ever share a cache line, and presumably C99/C11 could be
> implemented on such a chip.
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]