CST334 - Week 27
- YZ

- Jul 20, 2020
- 2 min read
This week, we continued learning about the topic of memory virtualization. We started off reading about free space management and the different ways to manage free space, including splitting and coalescing. If the memory requested is smaller than the available memory region, that region will be split, a part of it allocated and returned to the caller, and the other part remaining on the free list. Coalescing is merging two chunks of available memory that are next to each other into one larger chunk in order to preserve a larger amount of free space.
Next, we dove into the topic of paging. Paging is a method that chops memory space into fixed-size pieces rather than variable-sized pieces as seen in segmentation. The fixed-size unit is a page and physical memory contains an array of page frames that each holds one page of virtual memory. Each process must maintain a page table, which stores information about the translation from the address of a virtual page to its physical frame in memory, using the VPN (virtual page number) and an offset. Translation-lookaside buffers, called TLBs, speed up address translation. It is a cache that holds popular translations that can be referenced quickly, before needing to go to the page table. A TLB hit indicates that the requested translation is in the cache, while a miss indicates that it is not. A replacement policy will be implemented to dictate which page translation should be evicted when a TLB miss occurs. Some policies are LRU (last recently used) and a random approach. Another interesting topic we covered is multi-level paging, which saves space as only valid pages are allocated, supporting sparse address spaces.
If the memory needed exceeds physical memory, the OS will store address space in the "swap space" on disk. If a page is not present in memory, a page fault will occur and a handler will need to swap that page into memory so that it can be accessed. Thus, a page replacement policy will need to be implemented. Here, too, policies such as LRU, LFU, FIFO are used. The lab this week instructed us to write a program that simulates a FIFO page replacement algorithm and test it out. This week was packed with a lot of reading, the usual quiz, discussion, and lab, and a midterm! We're halfway there!




Comments