CS FundamentalsVery hardProduct company interview · GATE level

A 32-bit system uses two-level paging: 10 bits for the outer index, 10 bits for the inner index and a 12-bit offset, with 4-byte entries (so every table is one 4 KB page). A process uses only an 8 MB region starting at virtual address 6 MB (0x00600000) and a 6 MB stack at the very top of the address space. Page tables are created only where needed. How much memory do its page tables occupy?

  1. A. 20 KB
  2. B. 24 KB
  3. C. 4 MB
  4. D. 32 KB

Correct answer: B. 24 KB

Each inner table maps 1024 x 4 KB = 4 MB. The 8 MB region covers 6 MB to 14 MB, which touches the 4 MB slices 1 (4-8 MB), 2 (8-12) and 3 (12-16): 3 inner tables, not 2, because it does not start on a 4 MB boundary. The stack covers 4090-4096 MB, touching slices 1022 and 1023: 2 inner tables. With the outer table that is 1 + 3 + 2 = 6 pages = 24 KB. 20 KB assumes 8 MB needs only 2 inner tables; 4 MB is the size of a flat single-level table.

More Operating Systems questions

Exams that ask this topic