RAM · ROM · DRAM · SRAM · Cache · Memory Hierarchy
CSZoneCambridge International AS & A Level Computer Science 9618
RAM vs ROM
The Two Types of Primary Memory
RAM — RANDOM ACCESS MEMORY
Volatile — loses data when power removed. Read and write (R/W). Holds currently running programs and data. Faster than secondary storage. Larger = more programs can run simultaneously.
ROM — READ ONLY MEMORY
Non-volatile — retains data without power. Read only (cannot normally be written by user). Contains firmware (e.g. BIOS/UEFI — boot instructions). Cannot be accidentally overwritten.
DRAM vs SRAM
Two Types of RAM
DRAM — DYNAMIC RAM
Each bit stored in a capacitor + transistor. Must be refreshed thousands of times per second (charges leak). Slower than SRAM. Cheaper and more compact — used as main memory (RAM sticks).
SRAM — STATIC RAM
Uses flip-flop circuits (6 transistors per bit). Does not need refreshing. Faster than DRAM. Expensive and takes more space — used for cache memory (L1, L2, L3).
Key rule: DRAM = cheap, dense, needs refresh → main memory. SRAM = fast, expensive → cache.
Cache Memory
Fast Buffer Between CPU and RAM
Cache is a small, very fast SRAM memory built into or very close to the CPU. It stores copies of frequently used data/instructions from RAM to reduce the number of slow RAM accesses.
CACHE LEVELS
L1: Smallest (KB), fastest, closest to CPU core (usually per-core) L2: Larger (MB), slightly slower, may be per-core or shared L3: Largest (MB), slower than L1/L2, shared between all cores
CACHE HIT vs CACHE MISS
Hit: CPU finds needed data in cache → very fast. Miss: not in cache → must fetch from RAM → slower. Cache uses pre-fetching to predict what data will be needed next.
Memory Hierarchy
Speed vs Capacity Trade-off
CPU Registers
Bytes · Fastest · Most expensive
Cache (L1 → L3)
KB–MB · Very fast · Expensive
Main Memory (RAM)
GB · Fast · Moderate cost
Secondary Storage (SSD/HDD)
TB · Slower · Cheap
Archival (Tape/Optical)
Exabytes · Slowest · Cheapest
↑ Speed ↑ | ↓ Capacity ↑ Cost going up the pyramid
Exam Practice
Cambridge-style questions
Question 1
Explain why SRAM is used for cache memory rather than DRAM, despite DRAM being cheaper.
3 marks
1 mark
SRAM is significantly faster than DRAM — uses flip-flop circuits that do not need to be refreshed
1 mark
Cache needs to supply data to the CPU quickly to avoid the CPU waiting (reducing bottleneck)
1 mark
Cache is very small (KB to MB), so the higher cost per bit of SRAM is acceptable given the small quantity needed
Common Mistakes
Don't lose easy marks
1
Saying ROM is faster than RAM — ROM is generally slower than RAM. Its key property is that it is non-volatile (retains data without power), not that it is fast.
2
Calling RAM "permanent" storage — RAM is volatile (temporary). It loses all its contents when power is removed. Permanent data must be saved to secondary storage.
3
Saying cache stores the whole RAM contents — cache is tiny (KB/MB) and only stores recently or frequently used data. It is a small buffer, not a mirror of RAM.
Topic Summary — 1.3.5
What You Need to Know
RAM vs ROM
RAM: volatile, R/W, programs & data ROM: non-volatile, read-only, firmware/BIOS Both are primary (main) memory
DRAM vs SRAM
DRAM: capacitor, needs refresh, cheap, dense → main RAM SRAM: flip-flop, no refresh, fast, expensive → cache