EcrioniX Free VLSI
Catalog
⚑ Interactive Computer Architecture Explorer

RAM vs ROM vs Cache vs SSD

Your computer has multiple types of memory. But why does it need all of them? Explore how data is stored, accessed, and transferred inside a computer.

CPU ALU & Regs
↔
Cache SRAM (1-15 ns)
↔
RAM DRAM (50-80 ns)
↔
SSD NAND Flash (50 Β΅s)

Note: Architectural data flow representation. ROM / Firmware resides on a separate SPI bus for boot initialization.

⚑

Cache

Ultra-Fast On-Die SRAM

Small, blazing-fast memory right beside CPU execution units. Catches instructions and variables before the CPU stalls.

🧠

RAM

Volatile Working Memory

High-speed dynamic memory (DRAM). Holds the active operating system, open browser tabs, games, and runtime application data.

πŸ”’

ROM

Non-Volatile Boot Firmware

Persistent firmware memory (modern UEFI/BIOS in SPI Flash). Stores the critical boot instructions required when power is first switched on.

πŸ’Ύ

SSD

High-Capacity Flash Storage

Non-volatile NAND flash storage. Preserves your operating system, installed applications, and media files for years without power.

Explore the Memory Hierarchy ↓
The Architecture Pyramid

Interactive Memory Hierarchy Stack

Computer architecture relies on a fundamental trade-off: speed vs. capacity vs. cost. No single memory technology is both infinitely fast and infinitely large. Click any level to inspect its silicon microarchitecture, latency in clock cycles, and physical placement.

ℹ️ Architectural Note: Where is ROM? ROM (and modern SPI Flash Firmware) is not a direct level in the CPU caching hierarchy! Caches feed CPU computation during normal execution. Firmware storage lives across the motherboard chipset (PCH) connected via an SPI bus, executing at system reset to initialize hardware and load the operating system into RAM.
Dynamic Working Memory

RAM Explained: What Happens When You Open an App?

RAM stands for Random Access Memory. Unlike sequential storage (like old magnetic tape), any memory cell in RAM can be read or written in identical time, regardless of its physical location. Watch how an application moves from your SSD into working memory.

Application Launch Simulator

Follow the physical path of a 140 MB application from persistent storage into execution:

πŸ’Ύ SSD
Storage
β†’
🧠 RAM
Working Mem
β†’
⚑ CPU
Registers/ALU
β†’
πŸ–₯️ Window
Running
Ready to launch application. Click the button above to observe memory loading.
Why RAM is Essential: Opening a browser, switching applications, and loading game assets all demand high-bandwidth working memory (~50-90 GB/s). Running software directly from an SSD would make computers feel sluggish and freeze constantly.

Live RAM Block Allocator

Used: 6 / 32 Blocks (19%)
OS Kernel (Permanent) User Applications Free Pages
Non-Volatile Firmware

ROM Explained: What Does Your Computer Remember When Power is OFF?

ROM stands for Read-Only Memory. When your computer is unplugged, volatile RAM loses its state completely. How does the CPU know what to do when you press the power button? It reads hardwired instructions from non-volatile firmware.

Motherboard System Board
CPU Socket
x86-64 / ARM Core
SPI Flash ROM
UEFI / BIOS Firmware
DDR5 RAM
Volatile Channels
System initialized. Toggle "Power" button to see volatile RAM erase while Flash ROM persists!

Standard Hardware Boot Sequence

When power arrives, the CPU execution sequence follows these standardized architectural phases:

[Phase 1] Power Supply: PSU stabilizes voltages and asserts Power-Good signal.
[Phase 2] Reset Vector: CPU initializes program counter to hardwired vector (0xFFFFFFF0).
[Phase 3] Firmware Execution: CPU reads UEFI/BIOS instructions from SPI Flash ROM.
[Phase 4] Hardware POST: Power-On Self-Test initializes memory controllers, PCIe buses, display.
[Phase 5] OS Handoff: Bootloader reads OS kernel from SSD into RAM. OS assumes full control!
The Speed Multiplier

Cache Explained: Why Does a CPU Need Cache if RAM Already Exists?

CPUs operate at billions of cycles per second (3–5 GHz), completing instructions in 0.2 nanoseconds. But reading from off-chip DRAM takes 60–80 nanosecondsβ€”meaning a CPU without cache would spend 99% of its life waiting! Simulate cache hits and misses below.

Latency: Ready
CPU Core
< 0.5 ns
↔
L1 Cache
~1.0 ns (4 cyc)
↔
L2 Cache
~3.5 ns (12 cyc)
↔
L3 Cache
~12 ns (40 cyc)
↔
Main RAM
~65 ns (180 cyc)
Click "1. First Access" to simulate requesting variable data from memory.
Temporal Locality: Data accessed once is likely to be accessed again immediately (e.g. loop counters, local functions).
Spatial Locality: Data near recently accessed addresses is likely needed next (transferred in 64-byte Cache Lines).
Permanent Silicon Storage

SSD Explained: Where Does Your Data Go When You Save a File?

Solid State Drives contain zero mechanical moving parts. Instead of spinning platters, they store billions of bits as microscopic electrical charges trapped inside non-volatile floating-gate or charge-trap NAND transistors.

NAND Flash Die Cross-Section
Block 0 (OS)
Block 1
Block 2
Block 3
Click "Save a File" to observe page writes via the SSD Flash Translation Layer (FTL).
The Golden SSD Rule:

NAND Flash can be written in Pages (typically 4 KB – 16 KB), but can only be erased in entire Blocks (typically 2 MB – 8 MB). You cannot overwrite a single page directly without copying valid pages and erasing the whole block!

SSD Controller Brain:

The SSD controller runs firmware managing Wear Leveling (distributing writes evenly across silicon so cells don't burn out prematurely), ECC (Error Correction Code), and TRIM.

Direct Specification Matrix

Side-by-Side Comparison: Cache vs RAM vs ROM vs SSD

A comprehensive reference table contrasting physical silicon technology, volatility, typical capacity, latency, and primary purpose.

Feature CPU Cache RAM ROM / Firmware SSD
Full Technical Name CPU Cache Memory (L1 / L2 / L3) Random Access Memory Read-Only Memory / Flash Solid State Drive
Volatility Volatile (Loses state) Volatile (Loses state) Non-Volatile (Retains state) Non-Volatile (Retains state)
Silicon Technology Static RAM (6T / 8T SRAM) Dynamic RAM (1T-1C DRAM) Mask ROM / NOR SPI Flash 3D NAND Flash (SLC/TLC)
Typical Capacity 32 KB – 96 MB 8 GB – 64 GB 16 MB – 64 MB (Firmware) 512 GB – 4 TB
Typical Latency 1 – 15 ns (4–40 cycles) 50 – 80 ns (~180 cycles) ~100 – 300 ns (SPI bus) 50,000 – 100,000 ns
Relative Access Speed Extremely Fast (1st) Very Fast (2nd) Moderate (Init only) Slower than RAM (~1000Γ—)
Physical Location On-Die inside CPU Core Motherboard DIMM Slots Motherboard SPI Chip M.2 Slot / PCIe Bus
Primary Architectural Purpose Feed execution ALUs without stalling Active OS and runtime memory Bootloader & hardware initialization Permanent file & program storage
Qualitative Cost per Bit Ultra-High Moderate (~$3 / GB) Low per chip Lowest (~$0.08 / GB)
Knowledge Verification

Interactive Knowledge Test (10 Questions)

Test your understanding of computer memory hierarchy, volatility, and caching principles. Select an option for immediate feedback and technical explanations.

Score: 0 / 10
Practical Hardware Engineering

Real-World Scenario: Your Personal Laptop

You are using a modern workstation laptop. How do its physical memory components coordinate during everyday tasks?

πŸ’» 8-Core x86-64 CPU ⚑ 16 MB L3 Cache 🧠 16 GB DDR5 RAM πŸ’Ύ 512 GB NVMe SSD πŸ”’ 32 MB UEFI Flash
Deep-Dive Computer Architecture

Go Deeper: Advanced Silicon Memory Principles

Explore the circuit physics, cache associativity algorithms, and multi-core coherence protocols that power modern processors.

1. SRAM vs. DRAM: Circuit Physics & Transistor Topology β–Ό

The difference between Cache and RAM stems from their transistor-level circuit design:

  • Static RAM (SRAM, 6T Cell): Uses 6 transistors forming two cross-coupled CMOS inverters with two pass transistors. Because the circuit is a bistable multivibrator latch, it retains its stored logical state indefinitely as long as DC power is supplied. It requires no refresh cycles and switches state in sub-nanosecond intervals. However, 6 transistors per bit consume significant silicon area.
  • Dynamic RAM (DRAM, 1T-1C Cell): Stores each bit as electrical charge on a microscopic trench or stacked capacitor, accessed via a single MOSFET pass transistor. Because silicon junction leakage causes the capacitor charge to decay within milliseconds, DRAM requires an active refresh command every 64 ms (JEDEC standard), reading the charge with high-gain sense amplifiers and writing it back. This dynamic refresh makes DRAM slower, but a 1T-1C cell is up to 20Γ— smaller than a 6T SRAM cell, enabling affordable 32 GB DIMMs.
2. Cache Associativity: Direct-Mapped vs. Set-Associative vs. Fully Associative β–Ό

When a 64-byte block of memory is cached, where can it be placed?

  • Direct-Mapped: Each memory address maps to exactly one specific cache line (`Index = Address % Number of Lines`). It requires minimal comparison hardware (fastest lookup), but suffers severe conflict misses if two frequently used variables hash to the same line.
  • N-Way Set-Associative: The cache is divided into sets, each containing $N$ lines (e.g. 8-way or 16-way associative). An address maps to one set, but can reside in any of the $N$ ways within that set. A parallel tag comparator checks all $N$ ways simultaneously. This represents the gold standard used in modern L1, L2, and L3 caches.
  • Fully Associative: A memory block can reside in any cache line. Eliminates conflict misses entirely, but requires an associative comparator for every single line in the cache, limiting its use to small structures like Translation Lookaside Buffers (TLBs).
3. Multi-Core Cache Coherence: The MESI Protocol β–Ό

In a modern 8-core CPU, each core has its own private L1 and L2 cache. If Core 0 modifies variable `X = 5` in its private L1 cache, what prevents Core 4 from reading a stale copy of `X = 0` from its own L1 cache?

Hardware enforces Cache Coherence via the MESI Protocol (or MOESI in AMD processors):

  • Modified (M): The cache line is present only in the current cache and is dirty (modified relative to main memory).
  • Exclusive (E): The cache line is present only in the current cache and is clean (matches memory).
  • Shared (S): The cache line may be present in multiple cores' caches simultaneously (read-only sharing).
  • Invalid (I): The cache line does not contain valid data.

Cores broadcast invalidation messages across the on-die ring/mesh interconnect ("Bus Snooping"), forcing other cores to invalidate their local copies before a write proceeds.

4. Virtual Memory, Page Tables & The Memory Management Unit (MMU) β–Ό

Applications do not access physical RAM addresses directly. Every program runs inside an isolated 64-bit Virtual Address Space.

The hardware Memory Management Unit (MMU) inside the CPU translates virtual addresses into physical RAM addresses using multi-level Page Tables stored in memory. To accelerate this translation, the CPU caches recent translations in a specialized ultra-fast associative cache called the Translation Lookaside Buffer (TLB).

If an application requests memory that has been paged out to the SSD due to high memory pressure, a Page Fault interrupt is triggered, pausing the thread while the OS kernel reads the missing page from the SSD back into RAM.

5. 3D NAND Flash Cell Physics: SLC, MLC, TLC, and QLC β–Ό

NAND Flash cells store bits by trapping electrons inside an insulated floating gate or silicon nitride charge trap layer. The number of bits stored per physical cell determines capacity, speed, and endurance:

  • SLC (Single-Level Cell): 1 bit per cell (2 voltage levels). Fastest writes, highest endurance (~100,000 P/E cycles). Used in enterprise mission-critical caches.
  • MLC (Multi-Level Cell): 2 bits per cell (4 voltage levels). Good balance, ~10,000 cycles.
  • TLC (Triple-Level Cell): 3 bits per cell (8 voltage levels). The standard in modern consumer SSDs (~3,000 cycles).
  • QLC (Quad-Level Cell): 4 bits per cell (16 precise voltage levels). Highest storage density and lowest cost, but lower endurance (~1,000 cycles) and slower raw write speeds. Modern QLC drives use dynamic SLC caching to maintain snappy burst performance.