Given : 32 bit virtual address, 4KiB per page, 4B - size of page table entrie, 1 - GiB size of address space
For a process is using 1GiB address space, find out size of 1-level page table and 2-levels page table, when page table directory has got 1024 entries. For 2-level page table - What is max and min size of page table?
So... I know that page offset is 12 bits and page number is 20 bits. So we got 2^20 entries, so total page table size should be 4.2 MB for 1-level page table.
But how can I calculate size of 2-levels page table? any tips?
The two level case may be examined thus:
Now each level 2 page can map 2^10 * 2^12 bytes since it has 2^10 entries and each of those points to a page of 2^12 bytes. This yields 2^22 bytes.
Now your target address space is 2^30 (1GB) so you need 2^30/2^22 or 2^8 level 2 pages. In addition, you need one level one page.
The total used is 1 + 2^8 or 257 pages or 1028 KB