What is NUMA (Non-Uniform Memory Access)?
Why Interviewers Ask This
This is a differentiating question used for senior and lead roles. Interviewers want to see if you can explain not just what happens, but why — and what the trade-offs are in different approaches.
Answer
NUMA (Non-Uniform Memory Access) is a computer memory design where memory access time depends on the memory location relative to a processor. In systems with multiple CPU sockets, each CPU has "local" memory that it can access faster than "remote" memory on other CPUs' local banks. Why NUMA? All CPUs sharing a single memory bus creates a bottleneck. NUMA adds dedicated memory per CPU. Performance: local memory access: ~100ns; remote memory access (through interconnect like QPI/UPI/HyperTransport): 200-400ns — 2-4× slower. NUMA topology example (4-socket server): CPU 0 ↔ 128GB RAM (local) ↔ CPU 1 ↔ 128GB RAM (local) ↔ CPU 2 ↔ 128GB RAM (local) ↔ CPU 3 ↔ 128GB RAM (local). All CPUs can access all RAM but local is faster. NUMA in Linux: numactl --hardware — show NUMA topology; numastat — NUMA statistics per node; numactl --membind=0 --cpunodebind=0 ./app — pin app to NUMA node 0; /proc/sys/kernel/numa_balancing — automatic NUMA balancing. NUMA-aware allocation: numa_alloc_onnode(size, node) — allocate on specific NUMA node. Impact on software: memory should be allocated on same NUMA node as the CPU that will access it. Cross-NUMA access causes latency spikes. Java: JVM NUMA-aware heap: -XX:+UseNUMA. Databases: PostgreSQL, MySQL have NUMA awareness settings. Redis: numactl --interleave=all redis-server to spread memory across nodes. False sharing across NUMA nodes is very expensive. NUMA awareness in the OS scheduler: Linux scheduler prefers running tasks on CPUs near their memory (NUMA-local), migrates tasks when necessary.
Pro Tip
Before answering, structure your response: one-line definition → real-world analogy → concrete example from a project. This makes even complex Operating Systems answers easy to follow.
Previous
What is the boot process of a Linux system?
Next
What is cgroups (control groups) in Linux?
More Operating Systems Questions
View all →- Advanced What is the Linux kernel scheduling (CFS)?
- Advanced What is the difference between mutex, semaphore, and condition variable?
- Advanced What is virtual memory in detail — TLB, page tables, huge pages?
- Advanced What is the boot process of a Linux system?
- Advanced What is cgroups (control groups) in Linux?