从性能角度来看,虚拟地址空间映射如何才能被接受?
这个问题针对任何使用VAS模型的操作系统,但我将指定windows nt,因为这是我最了解的系统。
众所周知,默认情况下,32 位 Windows 上的进程本身会获得 2 GB 内存。该内存可以位于系统内存、交换文件、USB 驱动器等中。
这意味着多个进程可以在地址 0x12345678 处分配内存,但是这当然不可能映射到同一物理内存。
我的问题是,如何在不完全破坏性能的情况下完成此操作?处理器是否有某种机制来映射内存地址?
每次我们不想访问内存时都要求操作系统进行映射查找,看起来很慢。
This question is aimed at any OS using a VAS model, but I'm going to specify windows nt, since that's the system I know best.
As we all know, by default, processes on 32 bit windows get 2 GB of memory all by itself. This memory can be located in system memory, a swap file, an usb drive etc.
This means that several processes can have allocated memory at address 0x12345678, however it's of course not possible that this maps to the same physical memory.
My question is, how is this done without totally crushing performance? Do processors have some kind of mechanism to map memory addresses?
Asking the OS to do a map lookup every time we wan't to access memory, just seem so, slow..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
有一个硬件设备可以执行转换 - 它称为内存管理单元 (MMU)。大多数现代 CPU,甚至智能手机等设备中使用的 CPU,都包含 MMU。
There is a hardware device that does the translation - it's called the Memory Management Unit (MMU). Most modern CPUs, even those used in devices like smartphones, include an MMU.
是的,他们有,这就是虚拟内存的用途。对由硬件映射到物理内存单元的虚拟地址 0x12345678 的每次内存访问(或者由于该虚拟地址没有物理内存而导致中断)
Yes, they have and it's what virtual memory is for. Every single memory access to virtual address 0x12345678 mapped by hardware to physical memory cell (or causes an interrupt because there is no physical memory for this virtual address)
早期虚拟内存实现的描述
http://www.multicians.org/multics-vm。 html
A description of an early Virtual Memory implementation
http://www.multicians.org/multics-vm.html