A Guide to Memory Systems

From Virtual Address to Physical RAM

A comprehensive guide to the hardware and software systems that manage computer memory, from OS-level virtual memory and paging to the hardware-level MMU, TLB, and Memory Controller.
Author

Chuck Nelson

Published

October 18, 2025

1 Purpose

This document explains the complete journey of a memory request, from the software abstraction of virtual memory to the hardware-level electrical signals that access a physical RAM module. You will learn how the Operating System and CPU hardware collaborate to create a fast, secure, and efficient memory system.

2 What You’ll Learn

By the end of this reading, you will be able to:

  • Define virtual memory and explain its role in process isolation and protection.
  • Describe the process of virtual-to-physical address translation, including the roles of the MMU, Page Tables, and the TLB.
  • Explain how the Memory Controller Unit (MCU) decodes a physical address to select a specific location in DRAM.
  • Differentiate between cache write policies (write-through vs. write-back).
  • Define Memory-Mapped I/O (MMIO) and its purpose.

This reading maps to the following program and course learning outcomes:

  • Program Learning Outcomes (PLOs):
    • 3. Apply terminology and numeric or system concepts: This document covers the entire memory system stack, including Virtual Memory, Paging, MMU, TLB, MCU, and RAS/CAS.
    • 6. Maintain environment: Understanding how the OS and hardware manage memory is critical for diagnosing performance issues like thrashing and for general system maintenance.
  • Course Learning Outcomes (CLOs):
    • 1. Identify hardware and basic network components: This reading explains the function of the MMU and MCU as critical hardware components in the memory system.
    • 3. Troubleshoot hardware and basic network components: Understanding the concepts in this guide is essential for diagnosing memory-related performance bottlenecks and system faults.

This exercise will help you develop the following skills and knowledge, which align with the O*NET SOC Code 15-1232.00 for Computer User Support Specialists.

Learning Objective O*NET KSAs Technologies Used
Explain the concept of virtual memory. Knowledge: Computers & Electronics, Operating Systems
Skills: Systems Analysis
Operating System Software
Describe the hardware role in address translation. Knowledge: Computers & Electronics
Skills: Reading Comprehension
Abilities: Information Ordering
N/A (Conceptual)
Explain the purpose of Memory-Mapped I/O. Knowledge: Computers & Electronics, Telecommunications
Skills: Systems Analysis
Device Drivers (Conceptual)

3 The Memory System: A Hardware & Software Partnership

Modern computing relies on a sophisticated partnership between the Operating System (OS) and CPU hardware to manage memory. The OS provides a powerful illusion—that every program has its own private, limitless, and simple pool of memory. The hardware is responsible for making that illusion a high-performance reality.

4 The Software Abstraction: Virtual Memory

Virtual Memory is the core abstraction. It decouples a program’s view of memory (the Virtual Address Space, or VAS) from the physical memory (RAM) actually available in the system.

4.1 Key Benefits of Virtual Memory

  • Isolation and Protection: Each process operates in its own private VAS. This prevents a program from accessing or corrupting the memory of another program or the OS. This is enforced by hardware Protection Rings, where the OS kernel runs in the privileged Ring 0 and user applications run in the restricted Ring 3.
  • Efficiency and Scarcity Management: The OS can load only the necessary parts of a program into RAM. When physical memory is scarce, the OS can move inactive memory pages to a swap file on the disk. When a program tries to access a swapped-out page, a page fault occurs, signaling the OS to load the data back into RAM. If the system spends too much time swapping, this is called thrashing.

4.2 Paging: The Mechanism of Virtual Memory

The dominant method for implementing virtual memory is paging, which divides memory into fixed-size blocks (e.g., 4KB):

  • Virtual Pages: Chunks of a process’s virtual address space.
  • Physical Page Frames: Chunks of physical RAM.
  • Page Table: A data structure managed by the OS for each process, which maps its virtual pages to physical page frames.

5 The Hardware Implementation: From Virtual to Physical

Translating a virtual address into a physical address is the primary job of the Memory Management Unit (MMU), a hardware component within the CPU.

graph TD
    A[CPU Generates Virtual Address #40;VA#41;] --> B{"MMU Splits VA"};
    B --> C[Virtual Page Number #40;VPN#41;];
    B --> D[Offset];
    C --> E{"MMU Checks TLB for VPN"};
    E -- TLB Hit (Fast) --> H["TLB Provides Physical Page Number (PPN)"];
    E -- TLB Miss (Slow) --> F["Access Page Table in RAM"];
    F --> G["Retrieve Page Table Entry #40;PTE#41;"];
    G --> H;
    H --> I["Combine PPN + Offset"];
    I --> J["Physical Address #40;PA#41; Generated"];

    style A fill:#a2c4e0,stroke:#333
    style J fill:#a2e0c4,stroke:#333
    style E fill:#f9d976,stroke:#333

5.1 The Translation Lookaside Buffer (TLB)

Because looking up the page table in RAM for every memory access is slow, the MMU contains a small, fast cache called the Translation Lookaside Buffer (TLB). The TLB stores recently used address translations. A TLB Hit provides the physical address almost instantly, whereas a TLB Miss forces the slower page table lookup.

5.2 The Memory Controller Unit (MCU)

Once the final physical address is generated, it is sent to the Memory Controller Unit (MCU). This component, also on the CPU, is the brain of the memory subsystem. It translates the physical address into the electrical signals needed to access the DRAM chips.

  • Physical Address Decoding: The MCU decodes the physical address hierarchically to select the correct memory module, chip, bank, row, and column.
    • Row Address Strobe (RAS): Activates an entire row of memory. This is the slowest part of the access.
    • Column Address Strobe (CAS): Selects the specific data from the already-open row.
  • Request Scheduling: The MCU acts as a traffic cop, reordering memory requests to maximize efficiency (e.g., by grouping requests to the same open row).
  • DRAM Refresh: The MCU periodically refreshes the charge in the DRAM cells to prevent data loss.

5.3 Caching and Write Policies

To further hide the slowness of DRAM, the CPU uses a cache hierarchy (L1, L2, L3). When data is written, the system follows a write policy:

  • Write-Through: Simple but slow. Data is written to both the cache and main memory at the same time.
  • Write-Back: Fast and efficient. Data is written only to the cache and marked as “dirty.” The write to main memory is deferred until the data is evicted from the cache.

6 A Special Case: Memory-Mapped I/O (MMIO)

To communicate with devices like GPUs or network cards, the system uses Memory-Mapped I/O (MMIO). This technique reserves ranges of the physical address space for hardware devices. When the CPU writes to an MMIO address, the MCU routes the request to the device over the PCIe bus instead of to RAM, allowing the CPU to control hardware using standard memory instructions.

7 Reflect and Review

ImportantReflection: 3-2-1

Now that you have reviewed this document, take a moment to reflect on your learning. In your Microsoft Teams Student Notebook, create a new page for this topic and write down the following:

  • 3 benefits of using virtual memory.
  • 2 hardware components involved in translating a virtual address to a physical address.
  • 1 question you still have about the difference between a page fault and a segmentation fault.

This reflection is for your instructor to review and helps solidify your understanding of the concepts.

TipCheck on Learning

Test your understanding with the following questions. These questions provide retrieval practice and reinforce key concepts covered in this reading. In your Microsoft Teams Student Notebook, answer the following:

  1. What is the difference between a virtual address and a physical address?
  2. What specific performance problem does the Translation Lookaside Buffer (TLB) solve?
  3. What is the role of the Memory Controller Unit (MCU)?
  4. Is a “page fault” a critical system error? Explain briefly.
  5. How does Memory-Mapped I/O (MMIO) allow the CPU to communicate with a device like a network card?
Back to top