Search⌘ K

TLB Issue: Context Switches

Explore how operating systems handle Translation Lookaside Buffer (TLB) contents during context switches between processes. Understand the challenges of retaining virtual-to-physical address mappings valid only for running processes and learn methods such as TLB flushing and Address Space Identifiers (ASIDs) to efficiently support virtualization while minimizing overhead.

With TLBs, some new issues arise when switching between processes (and hence address spaces). Specifically, the TLB contains virtual-to-physical translations that are only valid for the currently running process; these translations are not meaningful for other processes. As a result, when switching from one process to another, the hardware or OS (or both) must be careful to ensure that the about-to-be-run process does not accidentally use translations from some previously run process.

To understand this situation better, let’s look at an example. When one process (P1) is running, it assumes the TLB might be caching translations that are valid for it, i.e., that come from P1’s page table. Assume, for this example, that the 10th virtual page of P1 is mapped to physical frame 100.

In this example, assume another process (P2) exists, and the OS soon might decide to ...