RAM, ROM, and cache memory store data or instructions for different purposes. RAM is temporary working memory, ROM retains startup firmware, and cache supplies frequently needed data and instructions to the CPU quickly.
How They Differ
| Memory type | Main characteristics | Purpose |
|---|---|---|
| RAM | Volatile; larger and slower than cache; usually DRAM | Holds active programs and data |
| ROM | Non-volatile; normally read and infrequently rewritten | Retains firmware, including bootstrap instructions |
| L1 cache | Volatile; fastest and smallest; within each CPU core | Holds immediately needed data and instructions |
| L2 cache | Volatile; larger and slower than L1; often per core | Supplies a second cache level after an L1 miss |
| L3 cache | Volatile; largest and slowest cache level; commonly shared among cores | Limits access to slower RAM |
Volatile memory loses its contents when power is removed; non-volatile memory retains them. RAM and cache are volatile, while ROM is non-volatile.
When the CPU requests data, it follows the memory hierarchy: L1, then L2, L3, and RAM. Finding data produces a cache hit; not finding it produces a cache miss and a search of the next level. Cache is faster because it is close to the CPU and generally uses static RAM (SRAM). Main memory generally uses cheaper, denser dynamic RAM (DRAM).
A common misconception is that ROM is simply slow RAM. It is not: ROM is non-volatile firmware storage, whereas RAM is volatile working storage.
IB Exam Technique
For an IB comparison, state each memory type's purpose, volatility, relative speed, capacity, and location. Explain the L1-to-RAM search order when asked about performance. Do not claim L3 is universally “slow”: it is slower than L1 and L2 but normally much faster than RAM. Exact cache arrangements vary by processor architecture. Use the terms cache hit and cache miss.