Implementing a multi-process TLB with ASID isolation
This is a medium C++ coding problem that tests your understanding of virtual-memory translation in multi-process systems. It asks you to build a VIVT (Virtually Indexed, Virtually Tagged) TLB simulator that handles the homonym problem—the fact that different processes can use the same virtual address to mean different physical locations.
The core challenge is implementing correct isolation between address spaces using ASIDs (Address Space Identifiers), while also supporting global entries that must be accessible from any process. You need to manage lookup priority (ASID-specific entries before global fallbacks), handle entry insertion and invalidation correctly, and ensure your data structures support both fast translation queries and selective flushing. With up to one million translation calls, efficiency matters.
- Virtual-to-physical address decomposition (VPN and page offset)
- Multi-key TLB lookup: (ASID, VPN) as the translation key
- Global vs. ASID-specific entry semantics
- Selective invalidation (per-ASID vs. full flush)