18. Page Replacement Flashcards
On certain architectures, the MMU will search the page table itself to locate virtual-to-physical address translations missing from the TLB. What are the pros and cons of this?
The pro is that hardware is way faster.
The con is that the OS must set up the page tables in a fixed way that the hardware understands.
With a hardware-managed TLB, the kernel sees TLB faults. They are handled in hardware.
What is a TLB fault?
A required virtual to physical address translation is not in the TLB
What is a page fault?
The contents of a virtual page are either not initialized or not in memory.
Note: Every page fault is preceded by a TLB fault
Why is every page fault preceded by a TLB fault?
If the contents of the virtual page are not in memory, a translation cannot exist for it.
Why is it that not every TLB fault generates a page fault?
If a page is in memory and the translation is the page table, the TLB fault can be handled without generating a page fault
When must we swap in a page?
When the virtual address is used by the process
What do we need to do first to swap out a page?
We need to choose which page to move to disk
When swapping in a page, what might we need to do first?
We might need to choose which page to swap out
What is the cost of swapping a page out (page eviction)?
Mainly the time and disk bandwidth required to move a page to and from the disk
What is the benefit of swapping a page out (page eviction)?
The use of 4K (or a page) of memory (as long as the page on disk remains unused)
What are three methods of improving performance of page translations?
- OS uses methods to minimize the cost of a page swap
- Algorithms can be designed to maximize the benefits of a page while it’s in memory
- Minimize the page fault rate
What is thrashing?
When a computer’s virtual memory subsystem is in a constant stage of paging, rapidly exchanging data in memory for data on disk.
This causes the performance of the computer to degrade or collapse.
How do we maximize the benefit of page eviction?
Pick the page to evict that will remain unused the longest
What is the absolute best page to evict, the one that page replacement algorithms dream about?
A page that will never be used again.
What would we like to know about a page when choosing one to evict?
How long it will be before this page will be used again.
It’ll allow us to choose the one that won’t be used for the longest