Chapter 5: Q12E (page 491)
Question: In this exercise, we will examine space/time optimizations for page tables. The following list provides parameters of a virtual memory system.
Virtual Address (bits) | Physical DRAM Installed | Page Size | PTE Size (byte) |
43 | 16 GiB | 4KiB | 4 |
(5.12.1) For a single-level page table, how many page table entries (PTEs) are needed? How much physical memory is needed for storing the page table?
(5.12.2) Using a multilevel page table can reduce the physical memory consumption of page tables, by keeping active PTEs in physical memory. How many levels of page tables will be needed in this case? And how many memory references are needed for address translation if missing in TLB?
(5.12.3) An inverted page table can be used to further optimize space and time. How many PTEs are needed to store the page table? Assuming a hash table implementation, what are the common case and worst case numbers of memory references needed for servicing a TLB miss?
The following table shows the contents of a 4-entry TLB.
Entry-ID | Valid | VA Page | Modified | Protection | PA Page |
1 | 1 | 140 | 1 | RW | 30 |
2 | 0 | 40 | 0 | RX | 34 |
3 | 1 | 200 | 1 | RO | 32 |
4 | 1 | 280 | 0 | RW | 31 |
(5.12.4) Under what scenarios would entry 2’s valid bit be set to zero?
(5.12.5) What happens when an instruction writes to VA page 30? When would software managed TLB be faster than hardware managed TLB?
(5.12.6) What happens when an instruction writes to VA page 200?
Short Answer
(5.12.1)
The page table entries are and the page table size is
.
(5.12.2)
The number of levels needed is four. On TLB miss, the references needed for address translation is also four.
(5.12.3)
The page table entries needed to store the page table are . With hash table implementation, the best-case scenario requires one memory reference and the worst-case scenario requires memory references equal to the number of page table entries.
(5.12.4)
Entry 2’s valid bit is set to zero if there is a context switch of processes and it is no longer a valid translation.
(5.12.5)
When an instruction writes to a VA page 30, it is a TLB miss. The software managed TLB is faster than hardware managed TLB in case of TLB miss available in the processor’s cache.
(5.12.6)
When an instruction writes to VA page 200, an interrupt is generated.