开发者

How can virtual address space mapping be acceptable from a performance point of view?

开发者 https://www.devze.com 2023-01-12 05:02 出处:网络
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.

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 tot开发者_开发百科ally 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..


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.


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)


A description of an early Virtual Memory implementation

http://www.multicians.org/multics-vm.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号