GATE / CS ARCHIVE

GATE CSE 2002 / QUESTION 19(a)

Two-level address translation with equal index widths

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

GATE 2002, Q19(a) Descriptive
Report issue

Virtual Memory & Paging

Question 19(a), GATE 2002: Virtual and physical addresses are 32 bits, byte addressed, page size 4 KB, two-level page tables with equal index widths, each entry 4 bytes. Original19(a): Draw how a virtual address translates to a physical address.
Question 19(a), GATE 2002: Virtual and physical addresses are 32 bits, byte addressed, page size 4 KB, two-level page tables with equal index widths, each entry 4 bytes. Original19(a): Draw how a virtual address translates to a physical address.
Tap to enlarge
Answer & solution

Answer: Virtual address: 10-bit outer index | 10-bit inner index | 12-bit offset; physical address: 20-bit frame number | 12-bit offset. (no official key was published)

A 4 KiB page has 212 bytes, so the low 12 address bits are the unchanged page offset. The remaining 32−12=20 virtual-page bits split equally into two 10-bit indices. The translation is:
VA[31:22] --index--> first-level table --second-level table base
VA[21:12] --index into that table--> second-level entry --20-bit physical frame number
PA = (physical frame number << 12) | VA[11:0].
More explicitly, the first entry is at first_table_base + 4·VA[31:22]; it identifies the second-level table. The second entry is at second_table_base + 4·VA[21:12]; it identifies the data page frame. Validity and protection flags are checked along the way; absent or disallowed mappings fault. The diagram describes a successful translation and does not require a TLB assumption.

Original paper, page 10