Linux内核内存屏障

4

我是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;
它们看起来一样,这两个示例有什么区别?
1个回答

3

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接