Search

A technology, a device or an article

Shared RAM, different distances to data

NUMA links RAM access to page placement, thread location, and allocation policy. An architectural explanation without invented measurements.

Textile islands connected by short and long threads representing RAM locality.
Textile islands connected by short and long threads representing RAM locality. Conceptual AI-generated illustration; not a device photograph or a measurement result.ITNWS · Original ITNWS AI-assisted editorial illustration

A shared memory address does not promise an identical path to data. In a coherent NUMA system, a processor can access another node’s memory without changing how a pointer is written in the program. Latency and available bandwidth nevertheless depend on the physical relationship between execution and memory. A unified address space removes the requirement to manually send every object between separate computers. It does not abolish distance inside the machine. This distinction determines what RAM placement means once total capacity alone is insufficient to describe a system.

The Linux NUMA explanation connects this architecture with scaling memory bandwidth. Multiple nodes have their own resources, while an interconnect provides access to remote data. Node describes the topology presented to software, not necessarily a processor socket. A configuration can expose multiple nodes within one physical processor; memory nodes without their own execution cores also exist. Deriving the access map solely from the number of installed CPUs would therefore be misleading. The operating system works with the topology of the particular platform.

A node-distance table is not a stopwatch either. Relative values provided by the platform help the system choose preferred directions; they cannot directly be called nanoseconds for a real read. Interconnect traffic, controller access, and the particular request affect time. Even two addresses on one remote node can participate in different load conditions. The map describes a relationship between resources; a measurement reveals the cost of using it under specified conditions.

Keep a simple hypothetical machine in mind: nodes A and B, each with cores and 32 GiB of available memory. Total capacity is 64 GiB. While an A worker mainly uses A pages and a B worker mainly uses B pages, both can access local resources. If both working sets reside on A, the same 64 GiB does not become evenly used capability. B obtains some data remotely, while the path to A memory becomes a shared resource. These capacities and placements are assumptions for reasoning, not measurements of an editorial server.

The workload matters more than a mode name. Suppose an application allocates a large array, initializes it with one thread, and then gives nonoverlapping portions to workers on both nodes. The algorithm divides work neatly: nobody changes a neighbor’s portion. Physical placement need not match. With lazy allocation of private anonymous pages, the relevant moment is when physical pages are actually required. The malloc call alone is not a universal promise to place all bytes beside their future workers immediately. Library behavior, reuse of existing allocations, and the access pattern affect the details.

Under a typical local Linux policy, initial placement relates to the node of the thread causing allocation of the physical page. For a new anonymous array, that often happens on the first write access to a page. A simple read need not have the same effect because a shared zero page may be involved. First touch therefore needs a precise description of what occurred. If one thread really creates and fills all pages on A, handing pointers to B workers does not automatically move physical memory at that moment. The addresses still identify the existing contents through the same virtual locations.

Now replace sequential initialization with parallel initialization, so each future worker writes its own region while running on the appropriate node. Given suitable policy and available resources, initial placement can match subsequent use more closely. This is an engineering consequence of the hypothetical organization, not a guaranteed speedup. Pages are placement units, while array partitions can end inside a page. Two workers sharing one page cannot both have that entire page local simultaneously. Huge pages enlarge the relevant region further. Data partitioning must account for actual granularity.

Memory policy and CPU selection govern different relationships. CPU affinity restricts where a thread executes. Memory policy controls where pages come from within its scope. A thread can be pinned to B while its array stays on A. Initial locality can also be established before the thread is allowed to migrate. Configuring only one side cannot establish permanent proximity. A running system changes work distribution, and an application may change data ownership. A static topology image shows possibilities rather than the complete history of access.

The Linux memory-policy documentation distinguishes node preference, restriction to a set of nodes, and interleaving. Their meaning is not a scale from bad to good. Preference permits the specified fallback when a chosen source cannot satisfy an allocation. Binding establishes a stricter region. Interleaving distributes allocations and can help exploit aggregate bandwidth during shared streaming work. It does not promise to make every page local to every reader. A policy expresses workload requirements rather than a universal ranking of modes.

Wooden tiles between two regions representing memory-page placement.
Wooden tiles between two regions representing memory-page placement. Conceptual AI-generated illustration; not a device photograph or a measurement result. — ITNWS · Original ITNWS AI-assisted editorial illustration

Return to capacity. If the hypothetical application needs 40 GiB but is restricted to A with 32 GiB, B’s free resources need not rescue the allocation under that strict restriction. The actual outcome also depends on occupancy, reclaim, and other system conditions. The total of 64 does not authorize a violation of policy. The opposite situation matters too: more flexible placement can allow work to continue at the cost of remote access. Increased latency then represents another compromise rather than an obligatory sign of defective DRAM modules.

Administrative restrictions provide another context. A process’s usable CPUs and memory can be constrained by cpusets, which take priority over its placement wishes. A process inside a container does not acquire the whole server because a library supports node selection. A node number in a setting also needs interpretation within the relevant allowed resources. When placement is unexpected, establishing active permissions is useful before searching for a physical memory-connection fault. Software restrictions can make the effective system substantially smaller than the equipment diagram.

Page migration can change physical placement while preserving the application’s virtual view. Migration is work, however: access must remain correct, contents must move, and relevant mappings must be updated. Its cost cannot disappear from elapsed time. If a new owner repeatedly uses the data, relocation may repay that cost. If ownership changes again almost immediately, or both nodes continually access the page, moving it may merely add traffic. There is no universal obligation to follow the latest accessing thread. Future access behavior matters and is not always known in advance.

Automatic NUMA balancing faces the same limit on knowledge. The system observes accesses and tries to improve execution and data placement, but observation costs resources and future application phases may differ from previous ones. A long repetitive calculation and a short run with one-time initialization offer different adaptation opportunities. An automatic mechanism therefore does not prove that initial placement has stopped mattering. Nor does its existence justify universally disabling it. That recommendation would require a specific workload and comparisons absent from this article.

Memory read frequently by many nodes presents a different problem from a partitioned, mutable array. Application-level replication is possible, but extra copies require capacity and coordination when they change. A shared page offers one authoritative instance; separate copies offer proximity to consumers. A coherence protocol does not automatically select the best application representation. It maintains specified visibility rules while leaving developers room to build structures with different sharing costs. Not every remote request necessarily deserves correction by copying the data.

Cache changes the meaning of observed access too. When a read is served by nearby cached contents, the source page’s physical location need not determine that read’s latency. Calling all of a thread’s work remote merely because pages reside on another node is too coarse. After a miss, the path to data matters again, while shared writes introduce additional cache relationships. Page placement, coherence, and reuse interact. They cannot honestly become one average latency for arbitrary accesses without a description of the workload.

Placement can be investigated through a process’s page map, including numa_maps, in relation to worker execution. The map describes location rather than supplying a timing result. The Linux numastat documentation separately defines counters for successful and unwanted allocations by node. These are not universal counters of all remote processor loads. Treating an allocation miss as a cache miss would substitute one measured quantity for another because they share a familiar word. The origin of each metric belongs in the explanation.

Our hypothetical array suggests how to separate causes in a study. When initial placement is compared, subsequent computation and worker distribution should remain understandable and comparable. Changing thread count, initialization, and page size simultaneously produces a result belonging to the combined change. The compute phase alone and total execution including initialization answer different questions; both can matter. We provide no measurements or universal remote-read price in nanoseconds. That price would require a platform, operating conditions, a method, and actual data.

Adding installed RAM also requires reading the topology. Extra capacity can appear on particular nodes and change available paths without making an existing application an informed allocator. Conversely, an application previously short of memory may benefit greatly despite some remote accesses. There is no contradiction: capacity and proximity are separate constraints. NUMA exists to provide a scalable shared system, not to declare remote memory useless. The meaningful outcome belongs to the complete task.

After a page moves, a pointer in the program may look exactly as it did before. The array’s numbers remain intact too. What changes is the physical relationship between execution and data, which ordinary address notation never displayed. Describing such a machine’s RAM therefore requires a map and a policy alongside capacity. Shared addressing remains a convenient software contract. Locality remains a property of actual placement that the contract allows us to improve without ever promising uniformity everywhere.

Sources & documentation

  1. Объяснение NUMA в документации Linux ↗
  2. документации политики памяти Linux ↗
  3. автоматического NUMA-балансирования ↗
  4. Документ Linux о numastat ↗