About this question
Medium · memory_optimization · Quant Developer interview question · huge-pages, mmap, memory, low-latency, tlb, linux, c++, kernel
High-frequency trading systems process massive order books, causing CPU Translation Lookaside Buffer (TLB) thrashing and adding significant memory latency. Using huge pages (e.g., 2MB vs 4KB) drastically reduces TLB pressure by allowing a single TLB entry to cover more memory, a critical optimization for market-making systems. This problem involves implementing a memory allocator that leverages huge pages on Linux for performance, with a graceful fallback for portability and system availability.