Chapter 9: Virtual Memory
In COW, how are free pages allocated?
From a pool of zero-fill-on-demand pages where the pool should always have free frames for fast demand page execution
What happens if the working-set window is too large in the working-set model?
If it's too large, it will encompass several localities
What happens if the working-set window is too small in the working-set model?
If it's too small, it will not encompass the entire locality
What is prepaging?
In order to reduce the large number of page faults that occur at process startup, prepaging brings some or all pages a process will need before they are referenced.
What is the working-set window within the working-set model?
The working-set window is a fixed number of page references, ex: 10,000 instructions
What is a page fault?
When a page is not in memory and needs to go get it (traps to the OS first to determine if it's an invalid reference or not in memory)
What is Belady's Anomaly?
When adding more frames can cause more page faults
What is I/O interlock?
When pages must be locked into memory to perform I/O operations on them; must be considered in a page replacement algorithm
What is thrashing?
Where if a process does not have enough pages, the page-fault rate is very high and is always swapping pages in and out. Leads to low CPU utilization.
What is Non-Uniform Memory Access (NUMA)?
Where the speed of access to memory varies depending on the type of memory
What is the valid-invalid bit?
With each page table entry, there is a valid-invalid bit associated with it. Tells you whether or not that page is in memory or not.
What are the two methods of virtual memory implementation?
1) Demand paging 2) Demand segmentation
What are the 4 steps of basic page replacement?
1) Find the location of the desired page on the disk 2) Find a free frame & if there isn't one, use a page replacement algorithm to select a victim frame and write it to disk if dirty 3) Bring the desired page into the free frame and update the page/frame tables 4) Continue the process by restarting the instruction that caused the TRAP
What does a frame-allocation algorithm determine (2 things)?
1) How many frames to give each process 2) Which frames to replace
What are the benefits of demand paging?
1) Reduces I/O 2) Uses less memory 3) Faster response times
What is a slab?
A slab is one or more physically contiguous pages.
What is a pager?
A swapper that deals with pages
What is a lazy swapper? What is the method of virtual memory implementation that is a lazy swapper?
A lazy swapper will never swap a page into memory unless the page will be needed. Demand paging is a lazy swapper.
What are memory-mapped files?
A memory-mapped file is a segment of virtual memory that has been assigned a direct byte-for-byte correlation with some portion of a file or file-like resource. Once present, this correlation between the file and the memory space permits applications to treat the mapped portion as if it were primary memory.
What is Copy-on-Write (COW)?
Allows both paren and child processes to initially share the same pages in memory. If either process modifies a shared page, only then is the page copied.
How does the FIFO algorithm work for paging?
As frames are requested, they are into memory and the older they are, the sooner they are left. Their ages are kept using a FIFO queue.
How does demand paging work?
Brings a page into memory only when it is needed
What is a cache in terms of a slab allocator?
Consists of one or more slabs
What is local replacement?
Each process selects only from its own set of allocated frames
What is the benefit of COW?
It allows for more efficient process creation as only modified pages are copied
What are the benefits of using a slab allocator?
It eliminates fragmentation and has fast memory requests
How do page-buffering algorithms work?
It keeps a pool of free frames and reads a page into a free frame and selects a victim to evict and add to the free pool. It also keeps a list of modified pages.
What are holes in logical address spaces used for?
Leaves room for growth and dynamically linked libraries
Does an entire program need to be in memory in order to execute?
No, this is because of the power of virtual memory
What is anonymous memory?
Pages not associated with a file (like a stack or a heap)
What are the pros/cons of prepaging?
Pros - reduce large number of page faults Cons - if prepaged pages are unused, I/O and memory was wasted
What is the LRU algorithm?
Replaces the page that has not been used in the most amount of time
What is virtual memory?
Separation of user logical memory from physical memory
What are the benefits of memory-mapped files?
Simplifies and speeds file access by driving file I/O through memory rather than through read and write system calls. Also allows several processes to map to the same file. Initially uses on-demand paging.
How does a slab allocator work?
Single cache for each unique kernel data structure; each cache filled with objects of these data structures. When objects are used, they are marked as used. If not in use, they are marked free.
What is a slab allocator?
Slab allocation is a memory management mechanism intended for the efficient memory allocation of kernel objects. The technique is used to retain allocated memory that contains a data object of a certain type for reuse upon subsequent allocations of objects of the same type.
How are logical address spaces usually designed?
Stack starts at the max logical address and grows down while the heap grows up - unused address space between is a hole
What is the working-set of a process in the working-set model?
The total number of pages referenced in the most recent working-set window
What do we want in a page-replacement algorithm?
The lowest page-fault rate on both first access and re-access
What is global replacement?
The process selects a replacement frame from the set of all frames and one process can take a frame from another
How do you calculate the total demand frames in the working-set model?
The total demand frames are the summation of all working-sets of all processes.
Can the logical address space be larger than physical address space?
Yes because ultimately all of it links to addresses in physical memory
Can several processes share address spaces?
Yes due to virtual memory
What is page-fault frequency?
You establish an acceptable page-fault frequency rate and use local replacement policy. If the rate is too low, the process loses a frame and if the rate is too high, the process gains a frame.