Virtual Memory Flashcards
Virtual Memory Idea
Separation of user logic memory from physical memory
With virtual memory, only
part of the program needs to be in memory for execution
Logical address space can be much _ than physical address space
Larger
What 2 things does virtual memory allow
Address spaces to be shared by several processes
More efficient process creation
Virtual Memory Goals 2
Make programmer’s job easier
Enable multiprogramming
What two ways can virtual memory be implemented?
Demand paging
Demand segmentation
Demand Paging
Bring a page into memory only when it is needed
Benefits of demand paging 4
Less I/O needed
Less memory needed
Faster response
More users
Page has invalid reference vs not in memory
Abort, bring to memory
What is valid/invalid bit?
In each page table entry, 0: not in memory or invalid, 1: in memory and lega. Initially all bits are set to 0 on all entries
What happens if a valid/invalid bit in a page table entry is 0 during address translation?
It will be considered a page fault and execution will be handed to OS
What happens if there is ever a reference to a page not in memory?
First reference will trap to OS (page fault)
OS needs to see if it is invalid reference (abort) or valid but not in memory (swap in)
Valid reference but not in memory steps
Get empty frame,
Swap (read) page into the new frame
Set the page table, and validation bit=1
Restart instruction
What happens if there is no free frame?
Page replacement: find some page that resides in memory, but is not really in use, swap it out to free up space
How to prevent over-allocation of memory?
Modify page-fault service routing to include page replacement
What is (dirty) bit used for?
Reduce overhead of page transfers. Only modified pages are swapped out (written to the disk)
What do we want from page replacement algorithms?
Lowest page fault rate
Reference string
String of memory references