ADVERTISEMENT
Responsive Ad Unit • Systems Architecture & Low-Level Engineering

Module 9 — Computer Memory (RAM, ROM, Flash, SRAM, DRAM)

Learning Objectives

After completing this module, you should understand:

  • What is memory?
  • Why do computers need different memory types?
  • SRAM vs DRAM
  • RAM vs ROM
  • Flash memory
  • NAND vs NOR Flash
  • EEPROM
  • DDR RAM
  • Memory Controller
  • Embedded memory architecture
  • Automotive ECU memory layout

1. What is Memory?

Memory is where a computer stores:

  • Instructions
  • Variables
  • Images
  • Audio
  • Operating System
  • Programs

Without memory,
the CPU has nothing to execute.

Think of memory as a notebook.
CPU = Student
Memory = Notebook
Program = Notes
The student (CPU) continuously reads and writes the notebook (memory).

Memory Hierarchy

Fast
Registers
↓
L1 Cache
↓
L2 Cache
↓
L3 Cache
↓
RAM
↓
SSD / Flash
↓
Hard Disk
Slow

The farther from the CPU,
the slower,
but larger,
and usually cheaper.

2. Why Multiple Memory Types?

Question:
Why not build the entire computer using registers?

Because:
Registers are extremely fast but very expensive and consume significant chip area.

Question:
Why not build everything with Flash?

Because:
Flash is non-volatile but much slower and has limited write endurance.

Different memories optimize different trade-offs.

Real-Life Analogy

Imagine your office.

Hands
↓
Desk
↓
Drawer
↓
Cupboard
↓
Warehouse

Equivalent

Registers
↓
Cache
↓
RAM
↓
SSD
↓
Cloud Storage

Frequently used items stay closest to you.

3. RAM (Random Access Memory)

RAM is the computer's working memory.
Everything currently running lives in RAM.

Example

Suppose
Windows boots.

Applications loaded
↓
RAM
Chrome
↓
RAM
Linux Kernel
↓
RAM
Camera Driver
↓
RAM
Your ADAS Algorithm
↓
RAM

The CPU executes code directly from RAM (or caches filled from RAM).

Characteristics

RAM

  • Fast
  • Read/Write
  • Volatile

Volatile means
Power OFF
↓
Everything disappears.

Example

Suppose

int x = 10;

Memory

Address
2000
↓
10

CPU reads

RAM
↓
Register
↓
ALU

4. ROM (Read Only Memory)

ROM stores permanent code.

Examples

  • BIOS
  • UEFI firmware
  • Bootloader
  • Microcontroller startup code

Characteristics

  • Non-volatile
  • Data survives power loss
  • Traditionally read-only after manufacturing (modern systems often use Flash instead of true ROM)

Example

Power ON
↓
CPU executes
↓
Boot ROM
↓
Bootloader
↓
Operating System

RAM vs ROM

RAM ROM
Volatile Non-volatile
Read/Write Mostly read during normal operation
Temporary Permanent firmware
Fast Generally slower than RAM
Stores running programs Stores boot firmware

5. SRAM (Static RAM)

SRAM is used inside

  • Cache
  • Small embedded memories
  • High-speed buffers

Why "Static"?

Because
It does not require periodic refreshing while power is applied.
As long as power exists,
the stored value remains stable.

Structure

Each bit typically uses about 6 transistors (6T SRAM cell).

6 Transistors
↓
1 Bit

Advantages

  • Extremely fast
  • No refresh
  • Low access latency

Disadvantages

  • Large silicon area
  • Expensive
  • Lower density

Applications

  • L1 Cache
  • L2 Cache
  • L3 Cache
  • Register files

6. DRAM (Dynamic RAM)

Main system memory uses DRAM.

Why "Dynamic"?

Each bit is stored as charge in a tiny capacitor.
Charge leaks over time.
Therefore
Memory must be refreshed periodically.

One bit

Capacitor
+
Transistor

Only one transistor plus one capacitor (1T1C).
Much denser than SRAM.

Advantages

  • Cheap
  • High density
  • Large capacity

Disadvantages

  • Slower
  • Requires refresh
  • Higher access latency

SRAM vs DRAM

SRAM DRAM
Very Fast Slower
No Refresh Refresh Required
Expensive Cheap
Low Density High Density
Cache Main Memory
~6 transistors/bit 1 transistor + capacitor/bit

Why Cache Uses SRAM

Suppose CPU executes

sum += array[i];

CPU may need data every cycle.
DRAM is too slow.
Therefore
CPU uses SRAM cache.

CPU
↓
SRAM Cache
↓
DRAM

Why RAM Uses DRAM

Suppose
Computer has
32 GB RAM

Imagine using SRAM.
Cost would be enormous.
Chip size would be impractical.
DRAM provides the required capacity at much lower cost.

7. DDR Memory

Modern RAM is
DDR
Double Data Rate

Meaning
Transfers data on

  • Rising clock edge
  • Falling clock edge

Older SDR transferred once per clock cycle.

Evolution

DDR
→
DDR2
→
DDR3
→
DDR4
→
DDR5

Each generation improves

  • Bandwidth
  • Capacity
  • Power efficiency

Embedded Systems

Automotive SoCs commonly use

  • DDR3
  • DDR4
  • LPDDR4
  • LPDDR5

depending on performance and power requirements.

8. Flash Memory

Flash stores

  • Firmware
  • Bootloader
  • Application images
  • Configuration
  • File systems

Characteristics

  • Non-volatile
  • Electrically erasable
  • Slower writes than RAM
  • Limited erase/write cycles

Example

ECU

Flash
↓
Bootloader
↓
Application
↓
Calibration

9. NOR Flash

Characteristics

  • Random access
  • Execute-In-Place (XIP) capable
  • Faster reads
  • Slower erase/write
  • Lower density

Used for

  • Boot firmware
  • Bootloaders
  • Microcontroller code storage

10. NAND Flash

Characteristics

  • Block-oriented access
  • Very high density
  • Faster erase/write than NOR
  • Lower cost per bit
  • Cannot normally execute code directly

Used for

  • SSDs
  • eMMC
  • UFS
  • SD Cards

NOR vs NAND

NOR NAND
Random Read Block Read/Write
Execute in Place Usually copied to RAM before execution
Boot Code Storage Devices
Lower Density Higher Density
Faster Reads Higher Sequential Throughput

11. EEPROM

EEPROM
Electrically Erasable Programmable ROM

Stores

  • Device configuration
  • Calibration
  • MAC address
  • Vehicle parameters

Characteristics

  • Non-volatile
  • Byte-level updates (unlike Flash, which typically erases blocks)

12. Memory Controller

CPU does not directly manage DRAM timing.
Instead

CPU
↓
Memory Controller
↓
DDR RAM

The Memory Controller handles

  • Row selection
  • Column selection
  • Refresh operations
  • Timing constraints
  • Burst transfers

Modern desktop/server CPUs usually integrate the memory controller on-chip.

13. Embedded Automotive Memory Map

Typical ECU

Flash
Bootloader
Application
Calibration
SRAM
Variables
Stack
Heap
Peripherals
UART
SPI
CAN
I2C
Timers
GPIO
ROM
Boot ROM

This layout varies by MCU/SoC, but the concept is similar.

14. ADAS Camera Example

Power ON
↓
Boot ROM
↓
Flash
↓
Bootloader
↓
Linux Kernel
↓
DDR RAM
↓
Camera Driver
↓
Image Buffers
↓
ISP
↓
Object Detection
↓
Display

Notice:

  • Firmware originates in Flash.
  • The kernel and applications execute from RAM.
  • Large image buffers reside in DDR.
  • Frequently accessed data moves through caches.

15. Why Operating Systems Care About Memory

The OS is responsible for:

  • Allocating RAM
  • Protecting memory
  • Managing virtual memory
  • Loading programs
  • Managing page caches
  • Handling DMA buffers
  • Sharing memory between processes
  • Freeing memory when processes terminate

Memory management is one of the OS's primary responsibilities.

Interview Questions

Beginner

  • What is RAM?
  • What is ROM?
  • Difference between SRAM and DRAM?
  • What is Flash memory?
  • What is DDR?

Intermediate

  • Why does SRAM not require refresh?
  • Why does DRAM require refresh?
  • Why is cache built with SRAM?
  • Difference between NOR and NAND Flash?
  • Why is Flash non-volatile?

Senior

  • Explain a complete automotive ECU memory map.
  • Why are image buffers stored in DDR?
  • Why isn't Flash used as main memory?
  • Explain the role of the memory controller.
  • How does the bootloader move execution from Flash to RAM?
  • Why is cache essential when processing high-resolution camera frames?

Common Mistakes

  • ❌ Thinking RAM and DRAM are the same term. DRAM is a technology used to implement most system RAM.
  • ❌ Assuming ROM and Flash are identical. Modern systems often replace traditional ROM with Flash, but they are not the same technology.
  • ❌ Believing Flash can replace DRAM as working memory. Flash has much higher write latency and limited write endurance.
  • ❌ Thinking SRAM is simply "better" than DRAM. SRAM is faster but much more expensive and less dense.

Summary

Modern computers use multiple memory technologies because no single technology provides the best combination of speed, capacity, cost, and persistence. Registers and SRAM provide very high performance close to the CPU. DRAM provides large working memory. Flash stores firmware and persistent data. The operating system coordinates these memory resources so applications can execute efficiently and safely.

Mini Quiz

  1. Why does a computer need different memory types?
  2. Why is SRAM faster than DRAM?
  3. Why does DRAM require refresh?
  4. Why is cache implemented using SRAM?
  5. Why is main memory implemented using DRAM?
  6. Why can't Flash replace DRAM?
  7. What is the difference between NOR and NAND Flash?
  8. What does the memory controller do?
  9. Where does a bootloader typically reside?
  10. Where are image buffers stored in an ADAS ECU?
Knowledge Check

Concept Mastery Assessment — Module 09

Verify your conceptual understanding with 12 targeted technical assessment questions. Instant feedback and explanations are provided for every choice.

Question 1 of 12
What fundamental physical difference distinguishes Static RAM (SRAM) from Dynamic RAM (DRAM)?
Explanation
SRAM uses 6-transistor bistable latches (fast, low density, used in caches). DRAM uses 1T-1C cells (slow, high density, leaks charge, requires periodic refresh).
Question 2 of 12
Why must Dynamic RAM (DRAM) undergo periodic refresh cycles thousands of times per second?
Explanation
DRAM storage capacitors lose charge through leakage currents and must be refreshed every few milliseconds (typically 64ms) to retain data.
Question 3 of 12
What does the 'Synchronous' in SDRAM (Synchronous DRAM) signify?
Explanation
SDRAM synchronizes its command and data transfers with the system bus clock, enabling pipelined burst transfers and predictable timing.
Question 4 of 12
What is the key technological innovation of DDR (Double Data Rate) SDRAM?
Explanation
DDR transfers data on both clock edges (rising and falling), effectively doubling transfer rates compared to Single Data Rate (SDR) memory.
Question 5 of 12
What memory latency metric represents the delay between the memory controller requesting a column of data and that data appearing on the bus?
Explanation
Column Access Strobe (CAS) Latency (CL) measures the clock cycles between issuing a column read command and receiving the first data word.
Question 6 of 12
What distinguishes Non-Volatile Memory (e.g., Flash, ROM) from Volatile Memory (e.g., SRAM, DRAM)?
Explanation
Volatile memory requires continuous electrical power to maintain data; non-volatile memory (ROM, Flash, NVRAM) preserves state when powered off.
Question 7 of 12
What is the difference between NOR Flash and NAND Flash memory technologies?
Explanation
NOR flash supports byte-level random reads and Execute-In-Place (XIP), ideal for BIOS/bootloaders. NAND flash is block-oriented, offering high density for SSDs.
Question 8 of 12
What is Memory Interleaving (Multi-Channel Memory Architecture)?
Explanation
Memory interleaving spreads sequential addresses across independent banks/channels (dual-channel, quad-channel), allowing simultaneous access to multiple words.
Question 9 of 12
What is Error-Correcting Code (ECC) memory, and where is it predominantly deployed?
Explanation
ECC memory uses parity bits and Hamming algorithms to detect and correct single-bit memory corruptions (caused by electrical noise or cosmic rays) in mission-critical servers.
Question 10 of 12
What happens when software attempts to write data to Read-Only Memory (ROM)?
Explanation
ROM circuitry does not support write operations; write cycles are either ignored by the chip or cause a bus fault / memory protection exception.
Question 11 of 12
What is 'wear leveling' in Flash memory storage controllers?
Explanation
Flash memory cells degrade after finite erase cycles (P/E cycles). Wear leveling rotates writes across all physical blocks to maximize SSD longevity.
Question 12 of 12
What is the typical access latency of DDR4/DDR5 SDRAM compared to modern NVMe SSD secondary storage?
Explanation
Main DRAM responds in tens of nanoseconds (~60-80ns), whereas fast NVMe SSD storage operates in tens of microseconds (~20-50us), a thousand-fold difference.
0 / 12 (0%)
Great job! Review the concepts above and proceed when ready.
ADVERTISEMENT
Responsive Ad Unit • Technical Courses & Certifications