Memory Management Flashcards
What is paged-based memory management?
Virtual memory is divided into pages, physical memory is divided into page frames (same size as pages). Pages tables map pages to frames
What is segment based memory management?
Virtual memory mapped into variable-length segments. Uses segment registers supported by hardware
What are the ways that hardware supports memory management?
MMU, registers, cache, memory translation
What is the MMU?
Memory management unit - included in the CPU and does address translation VA->PA. Reports faults if access is not allowed
What is the TLB?
Translate Lookahead Buffer. Part of the hardware cache that stores VA->PA mappings
What is allocation on first touch (aka demand paging)?
PA is only allocated when the program first tries to access it.
What is the purpose of a validity bit in a page table?
1 = page is valid and in memory, 0 otherwise ==> MMU will raise a fault, OS must decide what to do (swap, allocate PA, or page fault)
How large is a page table?
Total virtual addresses = 2^32
number of virtual pages = 2^32 / page size
need total / pages * entry size ==> does not scale
Explain a multi-level page table
Consists of an outer-page table and inner page table. First part of address is an index into outer table, which points into inner page table (which is a real page table). Then that points to the page frame. Size of inner page table == page frame. Size of outer page table == 2^remaining bytes
What are the benefits of a multi-level page table?
You do not have to allocate a page table for the entire page space. Any gaps in memory equal to page size * 2, can result in NULL in the outer page table
What are the pros/cons of adding more levels to page tables?
More levels == smaller page size == less wasted memory, but also means slower lookup times
What is an inverted page table?
IDK
What is external fragmentation?
When memory page allocation gets fragmented so that there is enough free memory to fulfill an alloc request, but it is not contiguous (and therefore the memory cannot be allocated)
What is the memory allocator?
Determines the VA->PA mappings
What is the buddy allocator?
Start with memory area of 2^x, when a new request comes in, divide area by 2 until it is just big enough