Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Physical View
Questions answered in this lecture:
What is paging?
How can segmentation and paging be combined?
How can one speed up address translation? Process 1
Process 3
Process 2
Logical View
1
Page Table Example Advantages of Paging
What are contents of page table for p3? No external fragmentation
• Any page can be placed in any frame in physical memory
frame R W page table base • Fast to allocate and free
5 1 1 – Alloc: No searching for suitable free space
7 1 1 – Free: Doesn’t have to coallesce with adjacent free space
– Just use bitmap to show free/allocated page frames
13 1 1
0 0 0 Simple to swap-out portions of memory to disk
9 1 1 • Page size matches disk block size
16 1 1 • Can run process when some pages are on disk
• Add “present” bit to PTE
Enables sharing of portions of address space
Process 3 • To share a page, have PTE point to same frame
2
Example of Paging and Advantages of Paging and
Segmentation Segmentation
Translate 24-bit logical to physical addresses Advantages of Segments
• Supports sparse address spaces
seg base bounds R W ...
– Decreases size of page tables
0x01f – If segment not used, not need for page table
0 0x002000 0x14 1 0
0x011
1 0x000000 0x00 0 0 Advantages of Pages
0x003
• No external fragmentation
2 0x001000 0x0d 1 1 0x02a
• Segments can grow without any reshuffling
0x013 0x002000 • Can run process when some pages are swapped to disk
...
0x002070 read: Advantages of Both
0x00c
0x202016 read: • Increases flexibility of sharing
0x007
0x104c84 read: – Share either single page or entire segment
0x004 – How?
0x010424 write:
0x00b
0x210014 write:
0x006 0x001000
0x203568 read:
...
base of pt
3
Translation Look-Aside Buffer
Page the Page Tables Continued
(TLB)
How should logical address be structured? Goal: Avoid page table lookups in main memory
• How many bits for each paging level? Idea: Hardware cache of recent page translations
• Typical size: 64 - 2K entries
Calculate such that page table fits within a page • Index by segment + vpn --> ppn
• Goal: PTE size * number PTE = page size Why does this work?
• Assume PTE size = 4 bytes; page size = 4KB • process references few unique pages in time interval
• spatial, temporal locality
2^2 * number PTE = 2^12
--> number PTE = 2^10 On each memory reference, check TLB for translation
• If present (hit): use ppn and append page offset
‡# bits for selecting inner page = 10
• Else (miss): Use segment and page tables to get ppn
Apply recursively throughout logical address – Update TLB for next access (replace some entry)
How does page size impact TLB performance?