我是Linux内核编程的新手。我对内存屏障文档中的GUARANTEES章节感到困惑。
我需要帮助理解该章节的内容。
Overlapping loads and stores within a particular CPU will appear to be ordered within that CPU.
*X = c; d = *X;
the CPU will only issue:
STORE *X = c, d = LOAD *X
然后是另一个例子:
它们看起来一样,这两个示例有什么区别?It must be assumed that overlapping memory accesses may be merged or discarded.
*A = X; Y = *A;
we may get either of:
STORE *A = X; Y = LOAD *A; STORE *A = Y = X;