977 views
2 votes
2 votes

Consider a computer system using 2-level paging with TLB. The logical address supported is 32 bits. The page table is divided into 512 pages each of size 1KB. Page table entry size at 1st level is 2Bytes and that at the second level is 4 Bytes each.

What is the memory overhead of storing the page tables of this process?

My Analysis:

Since the page table is divided into 512 pages each of size 1KB, means the page size is 1KB and hence offset bits are 10.

So, total page bits are 22(32-10).

Since at second level each page table size is equal to the size of a page=1KB, the number of entries that can come in 1-page table at second level=$\frac{1KB}{4B}=2^8$ entries

That means at the second level I need 8 offset bits to index into a second level page table.

And hence my address structure would be like below

14($P_1)$ 8($P_2$) 10$(offset)$

Now, since the process's page table is divided into 512 pages each of size 1K, that means at the second level I have only 512-page tables each of size 1K. My outer page table can contain a maximum of $2^{14}$ entries each of which can point to a $2^8$ entry second level page table for total $2^{22}$ pages that can be addressed by this computer.

So, for this process, at first level page table, first $2^9$ entries will be valid and they will point to a second level page table each of which is 1KB in size. Remaining, $2^{14}-2^9$ entries of the first level page table would be marked invalid and they won't point to anything.

So, all in all, this given process takes full 1st level page table(containing $2^{14}$ entries of which only $2^9$ are valid) plus 512 second level page tables each of size 1K.

So page table size of this process comes to be

$2^{14}*2B$(For first level PT)+$512*1KB$(At second level)=$544KB$

Is my analysis correct?

Below is the visualisation what I see is happening.

Please log in or register to answer this question.

Related questions

2 votes
2 votes
0 answers
1
gatejr asked Jun 10, 2016
771 views
Consider, 2 level paging , with Process P, Inner page table PTi, and outer page table PTo.Now we know that P and PTi are divided in various pages but PTo is in 1 page on...