Paging Flashcards
What happens to the physical address space when paging is introduced?
Divided into fixed sized blocks called frames
What happens to the logical address space when paging is introduced?
Divided into fixed size blocks called pages.
How does paging work?
Logical pages are allocated into physical frames
How are the logical addresses structured?
Two part logical address, page number (p) and page offset (d)
p = m-n
d = n
Where m = logical address space.
What does the page number index?
Page table, the lookup table that maps page numbers to frame addresses in physical memory.
How are the pages mapped to frames?
Page number doesn’t have to be the same as the frame number in memory, the page table handles the translation.
What is the size of a page?
Defined by hardware, typically 4/8KB. However, many systems support multiple page sizes.
What is the relationship between processes and paging?
Page table per process, defines the logical address space of the process.
Required pages allocated from available frames
What fragmentation does paging cause?
External - none.
Internal - Depends on page size and process requirements.
What are the trade-offs of page size?
Smaller pages = less internal fragmentation
larger pages = smaller page table
How are page tables implemented?
Dedicated registers, fast but only feasible for small page tables.
Page table held in memory, dedicated register points to page table when executing - pointer stored in PCB on context switch
What is the translation look-aside buffer?
TLB, set of dedicated high-speed associative registers, each containing a key:value.
Lookup examines all keys simultaneously.
Fast, expensive
Why should address translation be cached?
Exploit temporal and spatial locality in programs
Avoid page table lookups
What is TLB used for?
Subset of page table entries stored in TLB, keys are page numbers and values are frame numbers. Looked in before page table.
What happens on hit and miss in a TLB?
TLB Hit: Frame found
TLB Miss: Lookup page table, storage entry in TLB and replace existing entry if needed.