CS FundamentalsVery hardGATE CS (PYQ pattern)

A machine has 46-bit virtual addresses, 16 KB pages and 4-byte page-table entries. Lower page-table levels are full 16 KB pages; the top level holds only the leftover address bits; tables exist only where needed. A process uses 1 GB starting at virtual address 0 and a 16 KB stack page at the very top of the address space. How much memory do its page tables occupy?

  1. A. 289 KB
  2. B. 320 KB
  3. C. 304 KB
  4. D. 305 KB

Correct answer: D. 305 KB

Offset 14 bits; 4096 entries per page = 12 bits per level; 32 index bits = 8 + 12 + 12, so 3 levels and a 256-entry (1 KB) top table. 1 GB = 2^16 pages needs 16 leaf tables under one middle table. The stack needs its own leaf and middle table. Total 19 x 16 KB + 1 KB = 305 KB. Forgetting the stack gives 289 KB; a full-page top table gives 320 KB.

More Operating Systems questions

Exams that ask this topic