GATE / CS ARCHIVE

GATE CSE 2023 / QUESTION 58

GATE CSE 2023 Q58

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

GATE 2023, Q58 2 marks · NAT
Report issue

Virtual Memory & Paging

Question 58, GATE 2023: A 57-bit virtual address uses an L-level tree of page tables. Pages are 4 KiB; each page-table entry is 8 bytes at every level. Find L under the conventional one-page-per-table-node layout.
Tap to enlarge
Answer & solution

Official answer: 5

Step through it (8 steps)

A 4 KiB page has a 12-bit offset. Under the conventional one-page-per-page-table-node layout, each node holds 4096/8=512 entries and contributes 9 index bits. The virtual page number has 57-12=45 bits, requiring L=45/9=5 levels. The page-sized table-node convention is implicit in this standard multilevel-paging calculation.

Teaching detail. The address must be partitioned into a page offset and a sequence of table indexes. Offset bits select one byte within 4096 bytes, so there are 12. Each page-sized table contains 512 entries, whose selection requires 9 bits. Five indexes account for 45 virtual-page bits and, together with the 12-bit offset, exactly cover 57 bits. In cases where this division is not exact, the top-level index can be shorter; here no partial level is needed. The result depends on page-sized table nodes, not merely on entry width alone.

Original paper, page 61 · Answer key