CSUMB

CSUMB 334 - Week 4

Author

Date Published

CSUMB logo 2

Write a 1 - 2 paragraph journal post, of at least 250 words, of what you learned this week in CST 334.


Alright, I try to these blog posts short and sweet because, I am fairly confident I will be the only person to read these posts after the class is over but, I am not hitting the word requirement so bear with me as I regurgitate my learnings from this week.

This week was our final week of memory management. Specifically we covered Virtual Address Spaces, paging and cache-ing. Each of these topics build on our understanding of how memory addresses are managed and add a bunch of new features that makes memory management easier for the CPU while still protecting developers from themselves.

Virtual Address Spaces still isolate processes to a subset of physical memory but, also allow memory swapping should a process use more than what it available to it. These Virtual Address Spaces are usually tracked by Pages that group Virtual Memory Addresses together to make it easier for the CPU's MMU to locate memory within a Virtual Address Space. It makes the computation to translate a virtual address to a physical address very efficient.


Unfortunately, the page table that would need to be created to map every single virtual address space on modern machines would be huge and very slow. The solution for this is caching. Modern computers will cache recent page table lookups on a Translation Lookaside Buffer (TLB). This cache is small making lookups within the cache very fast.

There are a few options to manage cache most notably, First In First Out (FIFO) and Last Recently Used (LRU) these are simple solutions that can be applied to all workloads but, may not be the most efficient. You can use Belady's algorithm to figure out what would be the most efficient if you could see into the future and see if you can come up with a non-futuristic algorithm to get closer to the most efficient given a real life workload.

It is a common tech challenge to see who can create an algorithm that results in the closest percentage to Belady's algorithm.

Comments

Join the conversation! Login to reply to comments