两个CPU机器上的两个不同进程可以同时访问相同的RAM地址
如果我有一台带有两个 cpu 的计算机,每个 cpu 运行一个进程,那么它们都希望使用相同的虚拟地址“x”运行。它们是否会在物理地址空间中获得相同的位置? (因为它们是同时的,并且不知道另一个也请求空间并且可能意外地获得相同的物理地址)
If I have a computer with two cpu's which run a process each, they both want to take place on the run with the same virtual address 'x'. Could that happen that they get the same place in the physical address space? (Because they are simultaneous, and don't know that the other asked for space too and could accidentally get same physical address)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不,有一些内存原语允许对内存进行原子访问。这允许多个 cpu 进行协调。如果没有这种原语,两个 cpu 将无法协调它们的工作。
No, there are memory primitives which allow atomic access to memory. This allows multiple cpus to coordinate. Without this sort of primitive, two cpus would not have the ability to coordinate their efforts.
地址空间的分配是协调的,以便两个进程不会偶然共享其部分地址空间。操作系统可能在进程之间共享其地址空间的只读部分,典型的例子是程序本身。
Allocation of address spaces is coordinated so that two processes do not share part of their address space by chance. The OS might share between processes read only portions of their address spaces, the typical example being the program itself.
答案是“不”。有一些机制可以阻止它。
http://www.ece.cmu.edu/~ece548/handouts/19coher .pdf 有一些不错的幻灯片,在相对较高的水平上解决了该主题 - 但随附的文本可能会更有洞察力。
The answer is 'No'. There are mechanisms that prevent it.
http://www.ece.cmu.edu/~ece548/handouts/19coher.pdf has some nice slides that address the topic at a relatively high level - but the accompanying text would probably be more insightful.