Virtual Memory Flashcards
Virtual Memory?
Code needs to be in memory to execute, but entire program rarely used.
Entire program code not needed at the same time
Virtual Memory Definition?
Separation of user logical memory from physical memory.
Only part of the program needs to be in memory for execution
Logical address space can therefore be much larger than physical address space.
Virtual address space
Logical view of how process is stored in memory
Demand Paging?
Could bring entire process into memory at load time.
Lazy swapper?
Never swaps a page into memory unless page will be needed
Valid-Invalid Bit?
v -> in memory - memory resident
i -> not-in-memory
Page-Fault?
If there is a reference to a page, first reference to that page will trap to operating system
Steps of Page Fault?
- Operating System looks at another table to decide
- Find free frame
- Swap page into frame via scheduled disk operation
- Reset tables to indicate page now in memory
- Restart the instruction that caused the page fault
Page Replacement?
Prevent over-allocation of memory by modifying page fault service routine to include page replacement.
Use modify bit to reduce overhead of page transfers
Basic Page Replacement steps?
- Find the location of the desired page on a disk
- Find a free frame
- Bring the desired page into the newly free frame, update the page and frame tables.
- Continue the process by restarting the instruction that caused the trap
Frame Allocation Algorithm?
Determines
How many frames to give each process
Which frames to replace
Page-Replacement Algorithm
Want lowest page fault rate on both first access and re-access
Secondary Chance Algorithms consist of?
Reference Bit
Second-Chance Algorithm
Counting Algorithms?
Keep a counter of the number of references that have been made to each page.
Not common
Expensive to implement
Lease Frequently Used Algorithm?
Replaces page with smallest count