Reputation: 2895
Kind of a homework question but I am more trying to wrap my head around this concept:
If I have a 32bit virtual address in a two-level paging system where the page size is 8KB and the outer table has 1024 entries, how can I calculate how many bits are to represent (size of) the second level/outer page table?
The answer is supposedly 9 bits but I am unsure of how to calculate this or what the formula is.
Upvotes: 3
Views: 6116
Reputation: 15229
The virtual address is divided into this:
PTI - Page Table Index
1st PTI | 2nd PTI | Page Offset
The "outer page table", the first PTI, has 1024 entries. 10 bits are needed to represent 1024 different states because 2^10 = 1024
.
The page offset has to be capable of indexing 8 KiB of bytes, therefore it is 13 bits big. 8 KiB corresponds to 8192 different addresses and 2^13 = 8192
.
Now, the 2nd page table is left. We can calculate its size easily by subtraction:
32 = 10 + 13 + x = 23 + x | - 23
9 = x
x = 9
Therefore the "inner" page table can hold up to 2^9 = 512
entries.
Upvotes: 6