CS FundamentalsHardGATE CS (PYQ pattern)

On a 4-level x86-64 style paging system (4 KB table pages, 512 eight-byte entries each, 2 MB pages are leaves at the third level), a process maps exactly one 1 GB-aligned, fully used 1 GB region and nothing else. How many page-table pages (all levels, root included) are needed with 4 KB pages and with 2 MB pages?

  1. A. 512 and 1
  2. B. 515 and 4
  3. C. 262,144 and 512
  4. D. 515 and 3

Correct answer: D. 515 and 3

4 KB pages: 2^30 / 2^12 = 262,144 leaf entries = 512 leaf tables, plus 1 third-level (page-directory) table, 1 second-level table and the root: 515. 2 MB pages: the 512 leaves live in one page directory, plus 1 second-level table and the root: 3. Counting only leaves gives 512 and 1.

More Operating Systems questions

Exams that ask this topic