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
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.
Equivalent
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.
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
CPU reads
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
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).
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
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.
Why RAM Uses DRAM
Suppose
Computer has32 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
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
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
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
This layout varies by MCU/SoC, but the concept is similar.
14. ADAS Camera Example
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
- Why does a computer need different memory types?
- Why is SRAM faster than DRAM?
- Why does DRAM require refresh?
- Why is cache implemented using SRAM?
- Why is main memory implemented using DRAM?
- Why can't Flash replace DRAM?
- What is the difference between NOR and NAND Flash?
- What does the memory controller do?
- Where does a bootloader typically reside?
- Where are image buffers stored in an ADAS ECU?
Concept Mastery Assessment — Module 09
Verify your conceptual understanding with 12 targeted technical assessment questions. Instant feedback and explanations are provided for every choice.