Lecture16 SmallerTables
Lecture16 SmallerTables
Waste!
stack
Many invalid PT entries
Format of linear page tables:
PFN valid prot
10 1 r-x
- 0 -
23 1 rw-
- 0 -
- 0 -
- 0 -
- 0 -
how to avoid …many more invalid…
storing these? - 0 -
- 0 -
- 0 -
- 0 -
28 1 rw-
4 1 rw-
Avoid
simple linear Page Table
Use more complex page tables, instead of just big array
Any data structure is possible with software-managed TLB
• Hardware looks for vpn in TLB on every memory access
• If TLB does not contain vpn, TLB miss
• Trap into OS and let OS find vpn->ppn translation
• OS notifies TLB of vpn->ppn for future accesses
Approach 1:
Inverted Page TAble
Inverted Page Tables
• Only need entries for virtual pages w/ valid physical mappings
Naïve approach:
Search through data structure <ppn, vpn+asid> to find match
• Too much time to search entire table
seg #
page number (8 bits) page offset (12 bits)
(4 bits)
Implementation
• Each segment has a page table
• Each segment track base (physical address) and bounds of page table
for that segment
Quiz: Paging and
Segmentation
seg #
page number (8 bits) page offset (12 bits)
(4 bits)
Advantages of Pages
• No external fragmentation
• Segments can grow without any reshuffling
• Can run process when some pages are swapped to disk (next lecture)
Advantages of Both
• Increases flexibility of sharing
• Share either single page or entire segment
• How?
Disadvantages of Paging
and Segmentation
Potentially large page tables (for each segment)
• Must allocate each page table contiguously
• More problematic with more address bits
• Page table size?
• Assume 2 bits for segment, 18 bits for page number, 12 bits for offset
30-bit address:
outer page inner page
page offset (12 bits)
(8 bits) (10 bits)
20-bit address:
outer page inner page
(4 bits) (4 bits) page offset (12 bits)
QUIZ: Address format
for multilevel Paging
30-bit address:
outer page inner page page offset (12 bits)
VPN
PD idx 0 PD idx 1 PT idx OFFSET
If Hardware handles TLB miss, page tables must follow specific format
• Multi-level page tables used in x86 architecture
• Each page table fits within a page
Next Topic:
What if desired address spaces do not fit in physical memory?
.