Page 1 of 1

Amount of space needed for page directory+page tables

Posted: Wed Feb 20, 2013 8:18 pm
by LeoLeoLeo
If I understand correctly... the paging structures are set up so the page directory contains 1024 4-byte page directory entries, each of which point to a page table consisting of 1024 4-byte page table entries. So the total space taken up by the page directory entries and page table entries is 1024*1024*4 (1024*1024 page tables entries, four bytes each), plus 1024*4 (1024 page directory entries, four bytes each), for a total of 4.4 MB. Am I understanding this correctly? Because I keep seeing people refer to the paging structures as taking up 4 MB, and I'm not sure how that can be.

This is for x86, without PAE. Thanks very much!

Re: Amount of space needed for page directory+page tables

Posted: Wed Feb 20, 2013 8:50 pm
by NickJohnson
4198400 bytes (~4.004 MB) is a theoretical maximum. The whole point of having a page directory with page tables is that you don't need to have all the page tables allocated if you're not using the whole address space (which you're usually not), so in practice, you use much less than that per address space.

Re: Amount of space needed for page directory+page tables

Posted: Wed Feb 20, 2013 9:04 pm
by LeoLeoLeo
Oops, looks like I can't do math. Got it, thanks!

Re: Amount of space needed for page directory+page tables

Posted: Thu Feb 21, 2013 1:51 am
by b.zaar
Have a look at this it'll save the .004MB (4K) page that you're looking for

Self referencing page table