On a machine with 32-bit addresses, suppose an os uses two-level page tables with, a first level page table has 2048 entries, each second level page table has 2048 entries. Suppose a process has a text segment that occupies 64mb, a stack segment that occupies 128mb, and a data segment that occupies 32mb. How much space is occupied by the page tables for that process? (assume that each page table entry is 4 bytes)
Answers
Answered by
0
logical address=32 bit
page size= 4KB =2^12 byte ,
now we can write logical address = !!20!!12!! , 12 bits are for representing pages and 20 bits are for no of pages in 1st level page table.
so,
page table 1 = 2^20 * PTE = 2^20 * 4 byte = 4 MB > 1 page size , so we will do paging again on this page table. that it can fit in 1 page.
now, # of pages of page table = 2^22 / 2^12 = 2^10 pages
page table 2 = # of pages of page table1 * PTE
= 2^10 * 2^2 = 2^12 = 4KB which is equal to page size
so level of page table =2
now logical address = !! 10 !! 10 !! 12 !!
Similar questions