gpt4 book ai didi

Linux 内核内存屏障

转载 作者:IT王子 更新时间:2023-10-29 01:27:20 26 4
gpt4 key购买 nike

我是 Linux 内核编程的新手。我很困惑 the memory barriers文档,在保证一章中。

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;

他们看起来很像,这两个例子有什么区别?

最佳答案

你是对的,文档不正确。实际上您的文件版本不是最新的。 3.8-rc3 中有一个提交解决了这个问题: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=f191eec58803e1e16c3421638cdcc9195c425851

希望对您有所帮助。马蒂亚斯

关于Linux 内核内存屏障,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14291920/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com