Re: How to guarantee memory access orthogonality without atomics?

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

 



On 04/27/2012 10:23 AM, Leonard Plentz wrote:

> 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?

Yes.  If you have a look at the definition of a conflict in N3242=11-0012
you'll see

4 Two expression evaluations conflict if one of them modifies a memory
  location[1.7] and the other one accesses or modifies the same
  memory location.

... and in Section 1.7 ...

3 A memory location is either an object of scalar type or a maximal
  sequence of adjacent bit-fields all having non-zero width. ... Two
  threads of execution (1.10) can update and access separate memory
  locations without interfering with each other.

Andrew.


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

  Powered by Linux