Kvmzen Blog
← Back to Tech in practice

How CPU Finds Data In RAM: Virtual To DRAM Mapping

IndustryInsights ·~17 min read

How CPU Finds Data In RAM: Virtual To DRAM Mapping

You see a slow load instruction and assume the CPU is waiting on RAM.

The fastest correction is to trace the layers: virtual address → TLB or page table → physical address → cache hierarchy → memory controller → DRAM channel, rank, bank, row, and column. The final DRAM mapping depends on the platform.

This guide is for you if you are studying operating systems or computer architecture and keep mixing up virtual and physical addresses. It also helps performance engineers separate translation overhead from cache misses, and security developers reason about page tables, Rowhammer, or virtualized memory.

The one-load model: what the CPU is actually trying to do

Consider a simplified instruction:

value = *ptr;

The pointer ptr contains an address that the current process can use. That address is normally a virtual address, not a direct location on a RAM module.

The CPU creates this address while executing the load. Depending on the instruction and addressing mode, it may combine a base register, an index register, and a displacement. The result is sent toward the memory management unit, or MMU.

The process sees a private address space. Two different processes can use the same virtual address while their page tables map that address to different physical pages. This separation gives the operating system a way to enforce permissions, isolate processes, share selected pages, and move memory-backed pages without exposing raw hardware locations to application code.

Linux describes page tables as structures that map CPU-visible virtual addresses to physical addresses visible on the external memory bus. Its generic model represents page tables as a hierarchy, while the architecture-specific code determines how the hardware uses that hierarchy. See the Linux page-table documentation.

If you are connecting this theory to remote development, first identify whether your workload is running directly on a physical host, inside a virtual machine, or inside a container. Kvmzen’s support and contact information can help you clarify the environment details that affect testing and remote access.

Address or structure What it represents Who mainly controls it What you should not assume
Virtual address A process-visible address used by instructions and pointers Compiler, runtime, operating system, CPU execution It is not a RAM chip coordinate
TLB entry A cached virtual-page to physical-frame translation CPU hardware and operating-system invalidation rules A TLB miss is not automatically a DRAM miss
Physical address A location in the processor’s physical address space Page tables, operating system, platform architecture It does not directly reveal a DRAM bank or row
DRAM location A controller-selected channel, rank, bank, row, and column position Memory controller and platform design One fixed bit split works on every system

Key takeaway: the pointer tells the CPU which virtual page you want. It does not tell the CPU which RAM chip, bank, or row contains the data.

First checkpoint: TLB translation

The MMU translates addresses at page granularity. A virtual address can therefore be divided conceptually into two parts:

virtual address = virtual page number + page offset

The virtual page number participates in translation. The page offset identifies the byte within the page and remains unchanged when the page is mapped to a physical frame.

For common x86-64 paging modes, page sizes include 4 KiB and larger mappings such as 2 MiB or 1 GiB. The exact available modes and rules must be checked against the processor architecture manual rather than treated as a universal property of every CPU. Intel documents these paging and translation mechanisms in its 64-bit architecture software developer manuals.

The TLB stores recently used translations. If the virtual page number matches a valid TLB entry, the CPU can obtain the physical page-frame information without walking every page-table level again.

That is why repeated accesses within the same mapped page may avoid the full translation path. The TLB is a translation cache, not a data cache. It does not contain the requested integer, object, instruction bytes, or cache line. It only helps answer the address question.

Translation result What happens next Main diagnostic meaning
TLB hit Physical frame is obtained quickly; the load proceeds to cache lookup Translation is probably not the dominant issue
TLB miss, valid page table Hardware or system mechanism walks the page tables, then may refill the TLB Translation overhead exists, but data may still be in cache
Invalid or absent mapping A page fault or protection exception is raised Investigate allocation, permissions, copy-on-write, or paging
Large-page mapping Fewer translation entries may cover more memory Useful for selected workloads, but not automatically faster

The Linux kernel also treats the TLB as a CPU cache of virtual-to-physical translations and provides architecture-dependent interfaces for invalidating entries after page-table changes. Review the Linux cache and TLB flushing documentation when you are studying process switches, kernel mappings, or multi-core synchronization.

When the TLB misses, how does the page-table walk work?

A TLB miss asks the CPU to find the translation in the page tables. On systems with hardware-managed page walks, the processor uses a register-defined root for the current address space and reads the required entries. On other architectures or operating-system paths, the details differ, so avoid describing the mechanism as identical across all CPUs.

A multi-level page table breaks the virtual page number into indexes. Each level points to the next table, until the final entry supplies a physical page-frame number and access-control information.

Conceptually:

virtual page number
        ↓
root table index
        ↓
intermediate table indexes
        ↓
final page-table entry
        ↓
physical page-frame number

The page-table entry can include more than a frame number. It can encode whether the page is present, writable, executable, accessible from user mode, accessed recently, or modified. The bit layout is architecture-specific.

Linux’s current generic documentation describes a hierarchy containing PGD, P4D, PUD, PMD, and PTE levels. Some architectures fold levels or use a different effective structure. Higher-level entries can also map larger contiguous ranges, reducing the number of levels that must be traversed. These details are summarized in the Linux page-table hierarchy reference.

The page tables themselves reside in memory, which creates an apparent loop: to translate an address, the CPU may need to read memory that also requires address translation. Hardware avoids an endless recursion because the page-table-walk mechanism uses architectural rules and physical addressing for the page-table entries it must fetch. The root location is supplied through privileged architecture state, not discovered through the application pointer.

If the page-table entry is absent, inaccessible, or fails a permission check, the processor raises a page fault or protection exception. The operating system then decides whether the access can be satisfied. Possible cases include:

  • allocating a previously untouched anonymous page;
  • loading a page from backing storage;
  • resolving copy-on-write after a fork-like operation;
  • mapping a file-backed page;
  • rejecting the access as invalid;
  • terminating the process after a protection violation.

This is why “page fault” does not always mean the same thing operationally. Some faults can be resolved without disk I/O. Others require a much longer recovery path.

Second checkpoint: did translation finish, or did the cache miss?

After the CPU obtains a physical address, the load does not normally go straight to DRAM. It checks the cache hierarchy according to the processor’s design and memory type.

This creates three separate events that are often incorrectly merged:

  1. Translation miss: the TLB did not contain the virtual-to-physical mapping.
  2. Cache miss: the requested data was not found in the relevant cache level.
  3. DRAM access: the request reached the memory controller and required a memory-device operation.

A TLB miss can be followed by a cache hit. A TLB hit can be followed by a cache miss. A cache miss can be satisfied by another cache or a coherent peer rather than DRAM. The complete path depends on the CPU, coherence state, prefetch activity, memory type, and concurrent traffic.

The AMD64 programmer’s manual explains cache locality, cache-line fills, cache control, and memory typing in architecture-specific terms. Use the AMD64 architecture programming manual when validating behavior on an AMD64 platform rather than assuming that an optimization rule applies unchanged to another design.

Observed symptom Likely layer to inspect first Useful next action
Many translation-related events TLB reach, page size, access pattern Check page locality and large-page suitability
High cache-miss rate Data layout, working-set size, reuse distance Profile access patterns and improve locality
Long stalls with cache misses Memory controller and DRAM traffic Inspect bandwidth, contention, NUMA placement, and concurrency
Sudden major fault activity Virtual-memory pressure or invalid access Check resident memory, swap behavior, allocation, and permissions
Performance changes after moving to a VM Additional translation or memory-virtualization layer Compare guest and host counters, not only application time

For remote development or long-running AI workloads, this distinction matters. A process may appear to have “enough RAM” while still suffering from poor locality, excessive page-table pressure, reclaim activity, or container limits. Before changing hardware, compare the application’s resident memory, fault counters, cache behavior, and workload concurrency. This is also why a remote environment should be evaluated with repeatable memory and fault measurements rather than a single throughput score.

Why a physical address is not a RAM chip coordinate

A physical address is best understood as an address in the processor’s physical address space. It is the result of virtual-memory translation, but it is not necessarily a label printed on a memory chip.

Once a request reaches the memory subsystem, the memory controller interprets address bits. Depending on the platform, the controller may use some bits to select:

  • a memory channel;
  • a rank;
  • a DRAM bank;
  • a row;
  • a column;
  • an interleaving region;
  • a controller or socket in a multi-socket system.

The exact mapping can include address-bit rearrangement, hashing, XOR functions, interleaving, or firmware-selected policies. The same physical-address bit may therefore have different effects on different processor generations or memory configurations.

Mapping question Safe general statement Unsafe shortcut
Does a physical address identify RAM? It identifies a location in the system’s physical address space It identifies a specific DIMM pin
Does a physical page identify a DRAM row? It may influence the eventual row selection Every page maps to one predictable row
Are low address bits always column bits? Some systems use low bits for byte, burst, or column-related selection The same binary split applies to every platform
Can software infer the mapping? Research tools may infer behavior experimentally A portable API exposes the complete mapping
Does the operating system decide the row? It allocates physical pages and mappings It directly controls every controller address bit

This boundary is important for Rowhammer research and other side-channel work. A researcher may derive a platform-specific mapping from repeated measurements, timing behavior, physical-page information, and controlled access patterns. That does not turn the result into a universal rule for all CPUs and memory systems.

Do not publish a diagram such as “bits 0–5 are column, bits 6–8 are bank, bits 9–16 are row” unless you identify the exact platform, firmware assumptions, memory topology, and experimental method. Without those constraints, the diagram is more misleading than useful.

Third checkpoint: memory-controller selection

When a cache miss reaches the memory subsystem, the memory controller schedules a request. It must determine where the request belongs and how to issue the operation to the DRAM devices.

At a conceptual level, DRAM access involves a bank and an active row. If the requested row is already active in the selected bank, the controller may handle the request differently than when another row is active. The controller also considers command timing, outstanding requests, refresh operations, channel utilization, and fairness between requesters.

You should treat “row hit” and “row miss” as controller-level behavior, not as properties visible directly from a C pointer. The pointer generated a virtual address. The page table produced a physical address. The controller then applied its own mapping and scheduling policy.

Layer Input Output What determines the result
Program Pointer expression and instruction operands Virtual address Compiler, runtime state, registers
MMU Virtual page number and page-table root Physical page frame TLB, page tables, permissions
Cache hierarchy Physical address and request type Cache hit or lower-level request Cache tags, coherence, replacement policy
Memory controller Physical request DRAM command sequence Address mapping, scheduling, topology
DRAM devices Channel and command information Data burst Bank state, active row, timing constraints

For performance work, this means you cannot diagnose memory latency from the physical address alone. You need workload measurements and platform documentation. If you are comparing remote machines, record the software workload, concurrency, memory pressure, and test duration. A single benchmark result cannot reveal the hidden address mapping.

A complete load path, including virtualization

Return to:

value = *ptr;

A simplified sequence is:

  1. The CPU executes the load and calculates a virtual address from the pointer and instruction operands.
  2. The MMU checks the TLB for the virtual page.
  3. On a TLB hit, it obtains the physical page frame and preserves the page offset.
  4. On a TLB miss, the processor or system mechanism walks the page tables.
  5. The page-table entry supplies the physical frame and permission state.
  6. If the mapping is invalid, a page fault or protection exception interrupts the normal load path.
  7. The resulting physical address is checked against the cache hierarchy.
  8. If the data is present in a suitable cache, it can be returned without a DRAM transaction.
  9. If the cache lookup misses, the request travels toward the memory controller.
  10. The controller maps and schedules the request for the relevant channel, rank, bank, row, and column.
  11. DRAM returns a burst of data, which is placed into the cache hierarchy and forwarded to the instruction that requested it.

The order is useful for learning, but modern CPUs can overlap, speculate, prefetch, and reorder internal work within architectural rules. The diagram should therefore be read as a dependency chain, not as a promise that every internal circuit performs one isolated step at a time.

Virtual machines add another layer. A guest process first uses a guest virtual address. The guest operating system maps it to a guest physical address. The hypervisor or hardware virtualization mechanism can then translate that guest physical address to a host physical address before the request reaches the host memory system.

Environment First translation Possible second translation Final hardware decision
Bare-metal process Virtual → physical None at the guest level Cache and memory controller mapping
Virtual machine Guest virtual → guest physical Guest physical → host physical Host cache and memory controller mapping
Container Process virtual → host-managed physical page No separate guest address space by default Host memory policy and controller mapping

This is why a virtual machine can show a clean guest memory view while the host experiences contention, overcommitment, or additional translation overhead. When diagnosing a remote build or long-running agent, compare guest-visible faults and memory pressure with host-side capacity and scheduling data where available.

Common explanations that fail under scrutiny

“The CPU reads RAM using the pointer value.”
The pointer normally names a virtual address. The MMU and page tables determine the physical frame.

“A TLB miss means the data is in RAM.”
A TLB miss concerns translation. The data may still be in a cache after the translation is recovered.

“A physical address tells you the DRAM row.”
The physical address is an input to the memory controller. The controller’s mapping policy determines the device-level location.

“A page fault always means disk access.”
Some faults can be resolved through allocation, copy-on-write, or permission handling without reading storage.

“The same address-bit diagram works on every machine.”
DRAM address mapping is platform-specific. Validate the processor, firmware, memory topology, and measurement method before drawing conclusions.

For a deployment team, these distinctions also explain why “more RAM” is not a complete performance strategy. A workload can be limited by translation reach, cache locality, memory bandwidth, controller contention, or virtual-memory policy. If an Agent fails only after a long run, use a structured long-running Agent memory fault troubleshooting workflow instead of assuming that the first visible error identifies the hardware cause.

Which investigation layer matches your evidence?

Use this decision table before changing your development environment:

Your evidence Start with Why
High TLB activity and poor page locality Allocation pattern and page size The translation layer may be under pressure
High cache misses with stable resident memory Data structures and access order The working set may not fit the useful cache levels
Major faults or reclaim during long tasks Operating-system memory pressure The process may be losing resident pages
Stable application behavior but high memory stalls Platform bandwidth and contention The bottleneck may be below the process
Results vary across CPU generations Platform-specific documentation and counters Cache and DRAM policies are not portable assumptions
Guest-only measurements look normal but latency is unstable Hypervisor and host capacity A second address-translation and scheduling layer may exist

A good investigation follows the evidence in this order:

  1. Confirm the exact instruction and access pattern.
  2. Determine whether the pointer is virtual, kernel, mapped-file, or device memory.
  3. Check TLB-related and page-fault counters.
  4. Check cache misses and memory-stall events.
  5. Check resident memory, reclaim, swap, and container limits.
  6. Only then investigate DRAM channels, bank behavior, or platform-specific address mapping.

This order prevents an expensive mistake: trying to reverse-engineer DRAM rows when the actual problem is a page fault, a bad access pattern, or a memory limit imposed by the execution environment.

Frequently asked questions

How does a virtual address become a physical address?

The CPU sends the virtual address to the memory management unit. The MMU first checks the TLB for a cached translation. If the entry is absent, the processor or operating system follows the page-table hierarchy, validates permissions, obtains a physical page-frame number, and combines it with the unchanged page offset to create the physical address.

What happens after a TLB miss?

A TLB miss does not automatically mean that data must be read from DRAM. The processor may perform a hardware page-table walk, often using page-walk caches along the way. If the page-table entry is valid, the translation is installed in the TLB and the load continues. If the entry is missing or invalid, a page fault is raised.

Is a physical address the same as a RAM chip location?

No. A physical address identifies a location in the processor’s physical address space. The memory controller then interprets address bits according to the platform design. Those bits may select a channel, rank, bank, row, and column, but the exact mapping is implementation-specific and cannot be inferred from the physical address alone.

How are DRAM bank and row addresses determined?

The memory controller applies a platform-specific address-mapping scheme. Some physical-address bits may be used directly, while others may be XORed or interleaved to distribute traffic. The mapping can depend on the processor generation, firmware, memory topology, and controller configuration. Treat published diagrams as platform-specific evidence, not universal rules.

Final decision: what this means for a remote development setup

A self-managed workstation gives you direct control over the hardware, but it also leaves you responsible for RAM upgrades, thermal behavior, operating-system maintenance, remote access, and reproducible test conditions. A generic cloud VM adds another translation layer and may hide the host’s cache, memory topology, and contention from you.

For broader guidance on remote development, memory limits, and environment testing, you can consult Kvmzen’s technical resources without treating one machine or benchmark as a universal reference platform.

For short-lived builds, architecture experiments, Agent testing, or controlled remote development, renting a Mac environment through Kvmzen can be the cleaner operational choice: you avoid buying hardware for a temporary workload, reduce local setup work, and can focus on repeatable software-level measurements. It is not automatically the best option for permanent heavy workloads, unusual physical interfaces, or experiments that require direct access to DRAM signals and platform firmware.

The useful question is not “Which machine has the fastest RAM?” Ask instead: Which layer is limiting your workload, and do you need control over that layer? If you need a temporary, consistent environment, compare the available environment options and validate the workload with the same counters and test steps described above.

Frequently asked questions

How does a virtual address become a physical address?

The CPU sends the virtual address to the memory management unit. The MMU first checks the TLB for a cached translation. If the entry is absent, the processor or operating system follows the page-table hierarchy, validates permissions, obtains a physical page-frame number, and combines it with the unchanged page offset to create the physical address.

What happens after a TLB miss?

A TLB miss does not automatically mean that data must be read from DRAM. The processor may perform a hardware page-table walk, often using page-walk caches along the way. If the page-table entry is valid, the translation is installed in the TLB and the load continues. If the entry is missing or invalid, a page fault is raised.

Is a physical address the same as a RAM chip location?

No. A physical address identifies a location in the processor's physical address space. The memory controller then interprets address bits according to the platform design. Those bits may select a channel, rank, bank, row, and column, but the exact mapping is implementation-specific and cannot be inferred from the physical address alone.

How are DRAM bank and row addresses determined?

The memory controller applies a platform-specific address-mapping scheme. Some physical-address bits may be used directly, while others may be XORed or interleaved to distribute traffic. The mapping can depend on the processor generation, firmware, memory topology, and controller configuration. Treat published diagrams as platform-specific evidence, not universal rules.

Further reading

Limited-time offer

More than a Mac — your development base in the cloud

Dedicated compute · Global nodes · Monthly subscription · No hardware to buy

Back to home
Limited-time offer View plans