Skip to main content

GATE CSE 2021Operating System › Memory Management & Virtual MemoryVerified

GATE CSE 2021 PYQ: Consider a three-level page table to translate a 39 − 39- 39 − bit virtual address to a physical address as…

Consider a three-level page table to translate a 39−39-bit virtual address to a physical address as shown below:

GATE CSE 2021 Memory Management & Virtual Memory diagram: Consider a three-level page table to translate a 39 − 39- 39

The page size is 4 KB  (1KB=210\text{4 KB} \;(1\text{KB}=2^{10} bytes)) and page table entry size at every level is 8 bytes. A process PP is currently using 2GB  (1GB=2302\text{GB}\;(1 \text{GB}=2^{30} bytes)) virtual memory which is mapped to 2GB2\text{GB} of physical memory. The minimum amount of memory required for the page table of PP across all levels is _________ KB\text{KB}.

    Answer

    4108

    Approach

    For the three-level scheme, the 39-bit virtual address is split as 9 | 9 | 9 | 12 from outer level to page offset. Hence every page table has $2^9$ entries, so each page table occupies $2^9$ × 8 B = 4 KB. The process has 2 GB = $2^31 B$ of virtual memory, which corresponds to $2^19$ pages. The innermost (level-3) page table can map only $2^9$ pages, so $2^10 level-3$ page tables are needed. These require $2^10$ entries at level 2, giving 2 level-2 page tables. These in turn need 2 entries at level 1, so only 1 level-1 page table is needed. Sum the page tables and multiply by 4 KB.

    The minimum page-table memory is obtained by counting only the page tables actually required for the 2 GB of resident virtual memory: 1 level-1 table, 2 level-2 tables, and 1024 level-3 tables. Each table is 4 KB, so the total is (1 + 2 + 1024) × 4 KB = 4108 KB.

    Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.