Translation Lookaside Buffer Flashcards
What problems do the translation lookaside buffer deal with?
Translations are slow when paging.
Where is the Translation Lookaside Buffer located? What is its function?
In the MMU. It is a hardware cache of popular virtual to physical address translations.
What types of locality does the TLB make use of? How?
Spacial locality - When we load in a virtual page translation to the buffer, if we are accessing different parts of memory on this page, then we get cache hits.
Temporal locality - We are likely to get cache hits if we access the same memory multiple times.
How would the OS handle a TLB miss?
An exception will be raised, causing the process to go into kernel mode, where the OS will take over. The Trap handler will handle the translation.
Importantly, when we return from kernel mode, we must return to the instruction which caused the miss, as this instruction will now be in the cache.
What is it important to remember about the TLB when performing a context switch? How can we solve this problem?
The entries in the TLB will no longer be valid for the new context. We could solve this by either flushing the cache, or by using an “address space identifier” field to identify which process the translation works for.