Question
Consider a three-level page table to translate a 39-bit virtual address to a physical address as shown below.
The page size is 4KB () and page table entry size at every level is 8 bytes. A process is currently using 2GB () virtual memory which is mapped to 2GB of physical memory. The minimum amount of memory required for the page table of across all levels is ______ KB.
Official answer and solution
- Official answer
- 4108
- From
- Official GATE 2021 answer key
Solution
Calculate the number of pages mapped, determine the number of page table frames required at each level for minimum fragmentation, and sum their sizes.
The 39-bit virtual address breakdown is:
- Level 1 index: 9 bits ( entries per L1 table)
- Level 2 index: 9 bits ( entries per L2 table)
- Level 3 index: 9 bits ( entries per L3 table)
- Page offset: 12 bits ( page size)
Size of each page table:
Each page table at any level has 512 entries, and each entry is 8 bytes:
The process uses of memory. The number of virtual pages used is:
To minimize the number of page tables, assume the pages are placed contiguously in virtual address space:
- Level 3: Each Level 3 table maps 512 pages (). The number of Level 3 page tables needed is:
- Level 2: Each Level 2 table points to 512 Level 3 tables. To point to 1024 Level 3 tables:
- Level 1: A single root Level 1 table can hold 512 entries, which easily accommodates the 2 entries pointing to the 2 Level 2 tables:
Total number of page tables across all three levels:
Total memory required for the page table:
4108
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2021 Computer Science and Information Technology - Session 2 (CS2)
- Question
- 58 of 65, printed as CS Q.48
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.