P3L2 - Memory Management Flashcards
How does the OS decouple physical memory from memory that a process interacts with?
By providing a address space
T/F: The range of virtual addresses that are visible to a process can be much larger than the actual amount of physical memory?
True
What is allocation?
Requires that the OS incorporate certain mechanisms and data structures so it can track how memory is used and what memory is free?
What is arbitration?
Requires that the OS can quickly interpret and verity a process memory access and to translate a virtual address into a physical address and validate it to verify that it is a legal access
____ are fixed-size segments that the virtual address space is divided into
Pages
____ are the segments that the physical memory is divided into?
Page Frames
How does the operating system map pages into page frames?
Via page tables
T/F: Paging is not the only way to decouple the virtual and physical memories?
True - Another approach is segmentation, or a segment-based memory approach
______ is the dominant memory management mechanism
Paging
T/F: Memory management is not done by the OS alone?
True! Hardware mechanisms help
What unit is responsible for converting virtual into physical addresses?
The MMU (Memory Management Unit)
____ is a small cache of virtual-physical address translations
TLB (Translation Lookaside Buffer)
What is the use of page tables?
To convert the virtual memory addresses into physical memory addresses
T/F: For each virtual address, an entry in the page table is used to determine the actual physical address?
True!
T/F: The sizes of the pages in virtual memory are identical to the sizes of the page frames in physical memory?
True
When dealing with a single level page table, what is the first portion of the virtual address known as?
The Virtual Page Number (VPN)
When dealing with a single level page table, what is the last portion of the virtual address known as?
The Offset
What is produced by using the VPN in paging?
The Physical Frame Number - First physical address of the frame in DRAM
Given the physical frame number how is translation completed when dealing with a single level page table?
By using the offset to index into the physical frame to find the appropriate address
_____ is when physical memory is only allocated when the process is trying to access it?
Allocation on first touch
What is the reason for allocation on first touch?
To make sure that physical memory is only allocated when it’s really needed
What is the purpose of multi-level page tables?
To lower the size of a page table as the OS maintains one per process
What are inverted page tables?
A page table managed on a system-wide basis as opposed to per process
How does one determine the size of a page?
Number of bits in the offset
How does the buddy allocator work?
Starts with some consecutive memory region that is free and is a power of two. Whenever a request comes in, the allocator subdivides the area into smaller chunks such that every one of them is also a power of two. IT will continue subdividing until it finds a small enough chunk that is power of two that can satisfy the request
How does the slab allocator work?
Builds custom object caches on top of slabs where each slab represents contiguously allocated physical memory
_____ is the process by which physical page frames can be repeatedly saved and stored to and from some secondary storage?
Paging/Demand Paging
What happens when a page is not present in memory?
It has its present bit in the paging table entry set to 0
When should pages be swapped out of main memory and on to disk?
Periodically when the amount of occupied memory reaches a particular threshold
Which pages should be swapped out?
Pages that wont be used in the future
____ is a page replacement policy in which we look at how recently a page has been used and use that to inform a prediction about the page’s future use?
Least Recently Used (LRU)
In addition to LRU, what are other candidates for pages that can be freed from physical memory?
Pages that don’t need to be written out to disk
What is the default replacement algorithm in Linux?
Second chance - Performs two scans before determining which pages are the ones that should be swapped out