views:

32

answers:

3

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..

+1  A: 

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)

blaze
+1  A: 

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.

caf
Aah! I had a feeling this was solved on a hardware basis. Another cloud removed from my overall understanding of computer engineering ;)Thanks!
monoceres
+1  A: 

A description of an early Virtual Memory implementation

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

dbasnett