Part 1 :
32-bit virtual addresses and 1 KB pages means virtual address space is 32 bit and each page size is 1KB .
virtual address space is 32 bit so size of memory = 232 B = 4GB ..(i)
Each page table entry requires 32 bits = 4 B ..(ii)
page size is 1KB = 210 B ..(iii)
Number of pages = Number of entries in Innermost PageTable = 232 / 210 = 222 [ Divide (i) by (iii) ]
Size of Innermost PageTable = 222 * 22 = 224 B = 24 * 220 B = 16 MB ( as each page table entry = 4 B)
So, Page table has a size of 16MB ( 224 B ) , and thus it cannot fit in one page.
So, that's why we further divide page table into pages and form another page table for these pages (multilevel-paging). That means we keep on repeating above procedure till the size of page table ≤ Page Size
from (iii) we get page size is 210 B .
Number of pages by dividing PT1 = 224 / 210 = 214 ,
Page Table 2 ( PT2) size = no of pages * page table entry size = 214 * 22 = 216 = 64 KB
Number of pages by dividing PT2 = 216 / 210 = 26
Page Table 3 ( PT3) size = 26 * 22 = 28 = 256 B ( now 28 < 210 , where page size 210 )
we formed 3 page tables here so 3 levels of page table require .
page table 1 size 16 MB
page table 2 size 64 KB
page table 3 size 256 B
-------
Part 2 :
16 MB = (16*220 ) B = 16,777, 216 B
64 KB = ( 26 * 210 ) B = 65,536 B
so total page table size = ( 224 + 216 + 28 ) B = ( 16,777, 216 + 65,536 + 256 ) B = 16, 843, 008 B
Then the size of memory required is 16, 843, 008 B .