Logo

Coding preview

Address Translation 3

What this preview is

About this preview

Address Translation 3 is a medium quant coding problem on operating systems in Cpp.

Unlock full access to getcracked

Join to unlock this problem, detailed solutions, and our complete library of quant finance interview prep.

Implementing virtual-to-physical address translation in C++

This medium-difficulty coding problem tests your ability to implement a core operating-systems concept: the memory address translation pipeline. It requires careful bit manipulation, proper exception handling, and faithful adherence to a multi-step algorithm that real hardware executes on every memory access.

The problem gives you a precise specification involving TLB lookup, page-table consultation, and validity/permission checks at each stage. Strong solutions extract the VPN and offset cleanly, handle the TLB hit/miss branch correctly, check all fault conditions in the right order, and assemble the final physical address using bitwise operations. The main challenge is keeping track of which exception to throw under which condition and ensuring the algorithm flow matches the specification exactly.

  • Bit extraction and assembly using shifts and masks
  • Optional types and null-checking in the TLB lookup path
  • Multi-level permission and validity validation
  • Exception semantics (SegFault vs. ProtectionFault vs. PageFault)