Paging: Address Translation Arithmetic
The Tripos arithmetic pattern
Paging questions on the Tripos typically follow a fixed pattern: given a virtual address size, page size, and PTE size, compute table sizes, entry counts, and address splits. The key formula is:
Worked example: 32-bit system, 4 KB pages, 4-byte PTEs
- Page offset bits: bits.
- Page number bits: bits.
- Number of pages: .
- Page table size: MB per process.
Multi-level arithmetic
With 2-level paging, the page number is split into an outer page index and an inner page index. Suppose each inner page table fits in one 4 KB page and contains 4-byte PTEs:
- PTEs per inner table: PTEs.
- Bits needed to index the inner table: bits.
If the logical address is 32 bits, with 12-bit offset:
- Inner index: 10 bits (inner PT has 1024 entries)
- Outer index: bits (outer PT also has 1024 entries)
- Total addressable pages: pages — same as single-level, but the table is sparse.
The 5-level paging case (57-bit, 2025 paper)
The 2025 Tripos Q4 modelled a 64-bit machine with 57-bit virtual addressing, 4 KB pages, and 64-bit PTEs. This is the 5-level paging scheme proposed for Intel x86 (Ice Lake onwards).
- Page offset: bits.
- Remaining bits for page-table indices: bits.
- Each level indexes a 4 KB page of PTEs: PTEs.
Each level therefore uses bits. Five levels: bits — exactly matching the 45 bits above the offset.
Address decomposition
Given a 57-bit virtual address 0x00c0_ffee_ba5e_f00d:
Break into five 9-bit indices (from most significant) and a 12-bit offset:
Table sizes
| Level | Entries | Size |
|---|---|---|
| Level 5 (outermost) | 4 KB (1 page) | |
| Level 4 | 2 MB | |
| Level 3 | 1 GB | |
| Level 2 | 512 GB | |
| Level 1 (innermost) | 256 TB |
The total page-table size if fully populated is . In practice, it is sparsely populated — only the parts of the address space actually used are backed by physical page-table pages. A process using 2 GB of memory would populate only a tiny fraction of the table.
Addressable memory
57-bit addressing gives bytes. Using SI units:
(pebibyte or petabyte — both accepted in the mark scheme).
The key insight
Each additional level of page table adds 9 bits of address space (on systems with 512 entries per page). The number of bits above the offset is always a multiple of the bits needed to index one level. Stripping a virtual address into these bit-fields and showing the walk through each level is the standard Tripos technique.
Summary
- Address decomposition: split the virtual address into page-number fields and offset.
- Each level of a multi-level page table is indexed by one field.
- Total page-table size is astronomical if fully populated but sparse in practice.
- Each inner table fits exactly into one page, making memory management for the page table itself consistent with paging of user data.
Past Paper Questions
2025 Paper 2 Question 4: 57-bit virtual addressing, 5-level page table, 64-bit PTEs, 4 KB pages. Compute addressable memory, walk a virtual address through the levels, compute table sizes, and analyse a TLB + EAT problem. [20 marks]
2021 Paper 2 Question 3(a): Paging arithmetic on a system with given page size and address width.