What is Non-uniform memory access (NUMA)?

An organization in which each core has near and far memory, and far accesses take longer. Placing data and threads on the same side is faster.

Field: Multicore & Synchronization

Japanese name: NUMA

Why memory access becomes non-uniform

Modern processors integrate their memory controllers, so in a multi-socket server each socket has its own directly attached DRAM. A core reaching memory on its own socket goes straight through its local controller; reaching memory on another socket requires a trip across the inter-socket link and through the remote controller. The group of cores plus their local memory is called a NUMA node. Remote accesses typically show noticeably higher latency, often in the range of roughly 1.3 to 2 times local, and lower bandwidth, with the exact ratio depending on the platform and how heavily the link is loaded.

NUMA vs. UMA and vs. clusters

In a uniform memory access (UMA) system, often a single-socket machine with one memory controller complex, every core sees every address at about the same cost. A cache-coherent NUMA (ccNUMA) system keeps a single shared address space and hardware cache coherence, so unmodified programs run correctly; only their speed depends on where data lives. That distinguishes it from a cluster of separate computers, where each node has a private address space and data must be exchanged explicitly by message passing. Large chiplet-based processors can also expose more than one NUMA node within a single socket.

First-touch placement and its trap

Linux usually places a page on the node of the thread that first writes it, not the one that allocated it, since malloc only reserves virtual addresses. If a single thread zero-initializes a large array, every page lands on that thread's node, and later parallel loops on other nodes run almost entirely from remote memory, while one memory controller is saturated and the others sit idle. The fix is to initialize data in parallel with the same work partitioning as the computation, so that each thread's portion ends up local to it.

Tools and good practice

On Linux, numactl --hardware lists the nodes, their memory and a distance table in which local access is conventionally 10 and remote values are larger. The same tool can bind a process to a node's CPUs and memory, or interleave pages across nodes, which suits data that every thread reads evenly. Pinning threads (setting CPU affinity) keeps the scheduler from migrating a thread away from its data and makes benchmarks reproducible. The kernel can also migrate pages automatically toward the threads using them, but explicit placement is more predictable for performance-critical code.

Try it: questions about Non-uniform memory access (NUMA)

Which describes a NUMA (non-uniform memory access) system?

  1. AEvery core reaches all memory in the same time
  2. BEach core has near and far memory, and accessing far memory takes longer
  3. CEach core can read only its own memory and cannot use other cores' memory
Show answer and explanation

Answer: B. Each core has near and far memory, and accessing far memory takes longer

In servers with multiple CPU sockets, for example, each socket has memory attached directly, and other sockets' memory is reached over inter-socket links. Far memory is therefore slower and has less bandwidth than near memory. All memory appears in one address space, so programs run unchanged, but placing data and threads on the same side improves performance.

Under the first-touch policy common on Linux NUMA systems (a page is placed in the memory of the node where the thread first writing it runs), what should programmers watch out for?

  1. AUnder first touch pages are placed on random nodes
  2. BAll page placements are fixed when malloc is called
  3. CIf one thread zero-initializes a large array, all of it lands on one node, and threads on other nodes end up using far memory
Show answer and explanation

Answer: C. If one thread zero-initializes a large array, all of it lands on one node, and threads on other nodes end up using far memory

malloc alone assigns no physical pages; the page fault on first write places each page in the memory of the node where the writing thread runs. So if one thread does the initialization, the whole array gathers on that node, and in the parallel computation much of each thread's portion is in far memory. Initializing in parallel with the same division of work as the computation puts each portion near its thread.

FAQ

How do I check whether my machine is NUMA?

On Linux, run lscpu or numactl --hardware; more than one NUMA node listed means memory access cost depends on location. Most dual-socket servers show at least two nodes.

Do programs need to be rewritten for NUMA?

No, a ccNUMA machine presents one coherent address space, so programs run correctly as is. Rewriting matters only for performance, mainly by keeping each thread's data on its own node.

What is the first-touch policy?

It is the common rule that a physical page is allocated on the NUMA node of the thread that first writes to it. It is why parallel initialization of arrays matters on NUMA systems.

Questions that mention Non-uniform memory access (NUMA) (2)

Non-uniform memory access (NUMA) appears in 4 practice questions across 3 topics, including Multicore & Synchronization, Performance Analysis, DRAM.

  1. When measuring performance on multicore or NUMA systems, why are threads sometimes pinned to specific cores (setting affinity)?
  2. In most PC processors, where is the memory controller that controls DRAM located?

Books on Multicore & Synchronization Ad

As an Amazon Associate I earn from qualifying purchases.

This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.

Back to the glossary