Virtual Memory Flashcards
- [2pts] We’ve discussed the physical address space of the system and how it relates to the virtual address space of a process. The physical address space of the system is determined by what feature of the system?
- The amount of memory available
- Memory management system?
- One of the big problems we encountered as we managed physical memory was that of fragmentation.
(a) [4pts] Name and define the two types of fragmentation.
Internal Fragmentation: Wasted space within a unit of allocation
External Fragmentation: Wasted space between units of allocation
(b) [3pts] Why do we consider fragmentation to be a problem?
It’s wasted space
- One of the memory management techniques we studied was relocation.
(a) [2pts] Relocation suffers from what type of fragmentation?
External fragmentation
(b) [2pts] How do we eliminate that fragmentation with static relocation?
We don’t
(c) [2pts] How do we eliminate that fragmentation with dynamic relocation?
Defragmentation (Compaction)
Paging divides a process’s virtual address space into equally-sized pieces.
1. [2pts] How does the size of the virtual address space relate to the size of the physical address space?
The virtual address space is usually much bigger than the physical
2. One day, at home, for fun, you decide to write a program in C. Unfortunately, your program is very buggy (Did you just add a ’*’ ?), and so you use gdb to find and eliminate the bugs.
(a) [4pts] You print a stack backtrace, and gdb displays the stack along with the address of
each function call. Are these addresses virtual or physical?
Virtual
(b) [10pts] How would the system use that address to access the data it represents? Please
describe the steps of the process in a numbered list, and please be sure to include the TLB! Each step should be no more than twenty words.
(1) A concurrent request is sent to the TLB and the page table to find the translation of page number to frame number.
(2) If the translation is found in the TLB, then the request to the page table is stopped, and the frame number is returned.
(3) If the translation is not found, the translation is found in the page table and the translation is added to the TLB.
(4) The offset from the virtual address is added to the frame number to get the physical address.
As we studied virtual memory, we discovered that there are many places to improve efficiency, and therefore there are many policy decisions to be made. We discovered that many policies exist, largely because there are advantages and disadvantages to each.
- [3pts] Most systems use demand paging. How does demand paging increase efficiency?
It doesn’t load in pages until you need them, preventing unnecessary work
- [3pts] Some systems use pre-paging. How might pre-paging increase efficiency?
Pre-paging might increase efficiency if you load in all the right pages because it will result in less page faults
- [3pts] We saw that there were many possible page replacement policies. Why is the page
replacement policy important? How does it affect efficiency in the system?
It is important because it will run on every page fault, and will affect to the overall efficiency of the system
- [3pts] Some systems implement the working set technique in addition to using a page replacement algorithm. How might that combination increase efficiency?
Working set will decrease the amount of times the page fault handler needs to run by preemptively evicting pages and not letting memory fill up.
- [3pts] At this time, page sizes are increasing. How might a larger page size increase efficiency?
Larger page size can increase time efficiency because the system will page-fault less and increase space efficiency because the page table is smaller.
Relocation
One of the memory management techniques we studied is known as relocation.
1. [4pts] What is the main idea behind relocation?
Increase degree of multi-programming
- [2pts] In relocation, what type of address is generated by the compiler?
Physical address.
- [2pts] In static relocation, what type of address is generated by the CPU?
Virtual address.
- [2pts] In dynamic relocation, what type of address is generated by the CPU?
Virtual address.
- For each of the space management technique below, list whether the technique suffered from
internal fragmentation, external fragmentation, neither, or both. If you feel your answer needs
justification, justify it.
(a) [2pts] Relocation
External
(b) [2pts] Paging
Internal
(c) [2pts] Contiguous files
External