Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does PAE (Physical Address Extension) enable an address space larger than 4GB?

An excerpt of Wikipedia's article on Physical Address Extension:

x86 processor hardware-architecture is augmented with additional address lines used to select the additional memory, so physical address size increases from 32 bits to 36 bits. This, theoretically, increases maximum physical memory size from 4 GB to 64 GB.

Along with an image explaining the mechanism:

enter image description here

But I can't see how the address space is expanded from 4GB to 64GB. And 4 * 512 * 512 * 4K still equals 4GB, isn't it?

like image 406
amazingjxq Avatar asked Dec 04 '11 07:12

amazingjxq


3 Answers

x86 processors running in 32-bit mode uses page translations for memory addresses. This means that there is a mapping layer between the address used by the code (both kernel and user mode) and the actual physical memory. E.g. in Windows all processes map the image of the .exe file to the same address.

The mapping layer between the virtual and physical addresses can normally only map 4GB of memory. With PAE enabled, the 32 bit virtual addresses are mapped 36 bit physical addresses. Still, a single process cannot access more than 4GB at a single time. That's what you see in the image you've pasted, the 32-bit address space of one process. You can also see that the PTE (Page Table Entry) containing the physical address is 64 bit wide.

A PAE aware application can swap in and out different parts of memory into the visible address space to make use of more than 4GB of RAM, but it can only see 4GB at any single point in time.

like image 109
Anders Abel Avatar answered Nov 14 '22 07:11

Anders Abel


That's the virtual address space that's still 4GB. The physical address space is larger because the page table entries contain longer physical addresses of pages.

See, the picture says "64-bit PD entry" and "64-bit PT entry". Those extra 32 bits of the entries make up the longer physical addresses of pages.

With this particular scheme your application can still address up to 4GB of memory (minus the kernel portion that's generally inaccessible due to protection) at a time, but if you consider several applications, they can address more than 4GB of memory together.

like image 35
Alexey Frunze Avatar answered Nov 14 '22 06:11

Alexey Frunze


It does not. The address page never changes. What happens is that via API calls you can SWAP OUT areas of memory against other areas of memory. So, you still have only a full address space of 4gb (2-3 gb usable), but you can have another 2000 blocks of 512mb that you can swap into one part of the address space.

like image 3
TomTom Avatar answered Nov 14 '22 08:11

TomTom