GATE / CS ARCHIVE

GATE CSE 2003 / QUESTION 79

Memory used by sparse two-level page tables

Operating Systems · Virtual Memory & Paging · Full GATE CSE 2003 paper

GATE 2003, Q79 2 marks · MCQ
Report issue

Virtual Memory & Paging

Question 79, GATE 2003: A byte-addressable processor has 32-bit virtual and physical addresses and two-level page tables stored in main memory. Address bits are split 10 bits for first-level index, 10 for second-level index, and 12 for page offset. All page-table entries are 4 bytes. TLB hit rate is 96%, physical-cache hit rate 90%; TLB and cache access each take 1 ns, and main memory takes 10 ns. A process maps only two contiguous code pages starting at 0x00000000, two contiguous data pages starting at 0x00400000, and one stack page starting at 0xFFFFF000. How much storage is needed for its page tables?
A. 8 KB  B. 12 KB  C. 16 KB  D. 20 KB
Question 79, GATE 2003: A byte-addressable processor has 32-bit virtual and physical addresses and two-level page tables stored in main memory. Address bits are split 10 bits for first-level index, 10 for second-level index, and 12 for page offset. All page-table entries are 4 bytes. TLB hit rate is 96%, physical-cache hit rate 90%; TLB and cache access each take 1 ns, and main memory takes 10 ns. A process maps only two contiguous code pages starting at 0x00000000, two contiguous data pages starting at 0x00400000, and one stack page starting at 0xFFFFF000. How much storage is needed for its page tables?
A. 8 KB  B. 12 KB  C. 16 KB  D. 20 KB
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. A 10-bit index selects 1024 entries. At four bytes per entry each full table occupies 4096 bytes, one 4 KiB page.
2. One second-level table covers 1024 virtual pages, or 1024×4096=4 MiB. The code pages fall in the first 4 MiB region, top-level index 0. The data begins exactly at 4 MiB, index 1. The stack address has index 1023.
3. The two contiguous code pages share one second-level table, as do the two data pages. The stack needs a third second-level table. Add one top-level table: four tables total.
4. Storage=4×4096=16384 bytes=16 KiB, option C. Mapped content pages are not additional page-table storage.

Solution: Each page-table level has 210 entries of four bytes, so each allocated table uses 4096 bytes. The two code pages occupy top-level index 0; the two data pages starting at 0x00400000 occupy index 1; the stack page at 0xFFFFF000 occupies index 1023. Three second-level tables are therefore required, plus the first-level table. Total page-table storage is 4×4096=16384 bytes=16 KiB, option C. The five mapped code/data/stack pages are not themselves included in page-table storage.

Original paper, page 12