CST334 - Week 4
Week 4 Reflection
Paging - Virtual address --> Physical address
- Find the VPN bits (first X bits of a virtual address).
- Find the offset bits of the virtual address, which are the last Y bits (or, the virtual address with leading VPN bits removed).
- Find the corresponding PTE (if available). If the most significant bit (MSB) is a 1, it is a valid address. If 0, it is not valid and a physical address cannot be obtained from this virtual address.
- Find the PFN, which is the last Y bits of the PTE. If one is not listed, the number of pages a physical address can hold determines the PFN bits using the formula: [log2(number of pages)].
- Then, combine the PFN and offset in this order to obtain the translated physical address.
Swapping
Swapping makes use of a few policies to determine what pages to swap in memory:
- The optimal policy (aka Belady or MIN) replaces pages that are accessed furthest in the future to maximize cache hit rates. This is not very practical because implementing predictive measures is costly.
- FIFO (first-in, first-out) replaces pages that were added first in the queue.
- Random policy replaces a random page. It has slightly higher cache hit rates than FIFO, but worse than the optimal policy.
- LRU (least recently used) orders pages in a queue based on how often they are hit. The least recently used moves to the front of the queue, and is the first to be replaced.
- LFU (least frequently used) logs how often cached pages are used, orders them from least to most used, then replaces the least used page at the front of the queue.
Isopod Update: I got gestrois last weekend! The weather's getting colder so you know what that means.
Comments
Post a Comment