Unit 3 Session 3: Memory Hierarchy and Types | IT 231 Slides

--:-- --
↓ Scroll for more

Unit 3 · Session 3

Memory Hierarchy and Types

IT 231: IT and Application (BBM)

🎯 Learning Objectives

By the end of this session, you will be able to:

  • ✅ Define the computer memory hierarchy.
  • ✅ Describe the different levels of memory (registers, cache, RAM, storage).
  • ✅ Explain the trade-off between speed, cost, and capacity.
  • ✅ Differentiate between RAM and ROM.
  • ✅ Explain the types of RAM (SRAM, DRAM, DDR).
  • ✅ Describe the types of ROM (Mask ROM, PROM, EPROM, EEPROM, Flash).

Extension · if time permits

🎯 Pre-Check: What Do You Already Know?

A quick warm-up — no pressure! See what you already know.

1. Which of these stores data permanently, even without power?
2. In general, which memory type has the LARGEST capacity?
3. What does "volatile" mean in the context of memory?

What is the Memory Hierarchy?

Computers don't use just one type of memory. They use a variety, each with different strengths.

The memory hierarchy is a system that organizes these types based on performance and cost.

The Core Principle: A trade-off between Speed, Cost, and Capacity.

🎯 The Trade-Off Explorer

Click a memory level to see its Speed / Cost / Capacity trade-off profile:

The Memory Pyramid 📊

This pyramid visualizes the fundamental trade-offs in computer memory.

🔼 Top of the Pyramid

  • ⚡ Fastest Speed
  • 💰 Most Expensive (per byte)
  • 🤏 Smallest Capacity

🔽 Bottom of the Pyramid

  • 🐢 Slowest Speed
  • 💵 Cheapest (per byte)
  • 💾 Largest Capacity

Extension · if time permits

🎯 Memory Speed Sorter

Click memory types in order from FASTEST to SLOWEST:

1st (Fastest)?
2nd?
3rd?
4th (Slowest)?

Fastest and smallest at the top

Four-level memory pyramid: registers, cache, RAM and secondary storage, with speed, cost and capacity arrows

Level 1: CPU Registers

The Absolute Fastest Memory

  • Location: Directly inside the CPU chip.
  • Function: Holds the data the CPU is actively processing at this very moment.
  • Capacity: Extremely small (measured in bytes).
  • Analogy: The single thought you are having right now.

Level 2: Cache Memory

The Speed Bridge: Connects the ultra-fast CPU with the slower RAM.

  • Location: On or very close to the CPU.
  • Function: Stores frequently accessed data and instructions from RAM to save time.
  • Benefit: Drastically reduces CPU waiting time, making the system feel faster.
  • Analogy: The notes and tools on your desk for the task you're currently working on.

Cache is on the CPU chip itself

AMD Ryzen Zen 5 compute die photo with the cores, L2 cache and L3 cache areas labelled

🎯 Cache Hit or Miss? Simulator

Blue = in Cache | Grey = RAM only. CPU requests a random block each time.

In Cache RAM Only Requested
Hits: 0  Misses: 0  

🎬 Watch: Registers and Cache as a Library

Level 3: Primary Memory (RAM)

Random Access Memory (RAM): The computer's main workspace.

  • Location: On the motherboard.
  • Function: Holds the operating system, open applications, and data currently in use.
  • Key Property: It is volatile.

⚡ Volatile Memory: All contents are lost when the computer is powered off!

🎬 Watch: How a DRAM Cell Holds a Bit

Level 4: Secondary Storage

Long-Term Memory: Where your files live permanently.

  • Function: Stores data and programs for long-term, persistent access.
  • Key Property: It is non-volatile.
  • Examples: Hard Disk Drives (HDDs), Solid-State Drives (SSDs), USB drives.

💾 Non-Volatile Memory: Retains data even when the power is off.

🔍 Volatile vs. Non-Volatile

⚡ Volatile (e.g., RAM)

  • Temporary storage
  • Requires power to hold data
  • Data is lost on power-off
  • Much faster access

💾 Non-Volatile (e.g., SSD)

  • Permanent storage
  • No power needed to hold data
  • Data persists after power-off
  • Slower access

Extension · if time permits

🎯 Volatile or Non-Volatile? Classify It!

Card 1 of 8
Loading...

Practical Application: Loading an App

  1. Step 1 (Storage): You click an app icon. The app's files are read from your slow but large SSD.
  2. Step 2 (RAM): The main app files are loaded into your much faster RAM, the computer's "workspace".
  3. Step 3 (Cache): The most frequently used data is copied to the ultra-fast Cache to be ready for the CPU.
  4. Step 4 (Registers): The exact calculation for what to display next happens inside the CPU's Registers.

Context in Nepal: Buying a Laptop

When shopping in places like Putalisadak or New Road, you'll see these specs:

RAM (Primary Memory)

  • Specs like "8GB RAM" or "16GB RAM".
  • More RAM is crucial for multitasking (e.g., running Chrome, VS Code, and other apps).

Storage (Secondary)

  • Specs like "512GB SSD" or "1TB HDD".
  • An SSD makes your computer boot up and load programs much faster than an HDD.

Local Tip: For most students in Nepal, a laptop with at least 8GB RAM and a 256GB+ SSD offers the best balance of performance and price.

Extension · if time permits

🎯 Nepal Laptop Advisor

Select specs to see if a laptop from Putalisadak suits your needs:

Extension · if time permits

🎯 Memory Hierarchy: Final Quiz

1. Which memory type is located directly inside the CPU and is the fastest?
2. What happens to data stored in RAM when the computer is powered off?
3. A student in Kathmandu wants the fastest boot speed on a budget laptop. Which storage should they prioritise?
4. Cache memory acts as a speed bridge between which two components?

Primary Memory: Two Families

Primary memory is the working memory the CPU can access directly.

⚡ RAM

Volatile: loses its contents when power is off.

Read and write. Holds the programs and data in use right now.

🔒 ROM

Non-volatile: keeps its contents without power.

Mostly read. Holds firmware and start-up instructions.

Volatile vs Non-Volatile: Sort It!

Click each memory type to assign it to the correct category.

VOLATILE
NON-VOLATILE

RAM: Characteristics

  • Volatile: data is lost when the power is turned off
  • Read-write: data can be read and changed
  • Random access: any location can be reached directly
  • Fast and temporary: used for active programs and data

More RAM lets you run more programs at once and work with larger files.

Two Kinds of RAM: SRAM and DRAM

Static RAM (SRAM)

Uses flip-flop circuits (6 transistors per bit). No refresh needed.

Very fast, expensive, low density.

Used for CPU cache.

Dynamic RAM (DRAM)

Uses 1 transistor and 1 capacitor per bit. The capacitor leaks, so it is refreshed thousands of times per second.

Cheaper, denser, slower than SRAM.

Used for main memory.

🎬 Watch: Why SRAM Is Faster

Six transistors for one bit

Schematic of a six-transistor SRAM cell: two cross-coupled inverters and two access transistors

Extension · if time permits

SRAM vs DRAM: Which is Which?

Click a property card. Select SRAM or DRAM, then reveal the answer.

Score: 0 / 0

DDR SDRAM Generations

Modern DRAM transfers data twice per clock cycle (Double Data Rate).

GenerationTransfer rateVoltageYear
DDR200–400 MT/s2.5 V2000
DDR2400–800 MT/s1.8 V2003
DDR3800–1600 MT/s1.5 V2007
DDR41600–3200 MT/s1.2 V2014
DDR53200–6400+ MT/s1.1 V2020

Each generation is faster, uses less power, and holds more per module.

DDR5: desktop DIMM vs laptop SO-DIMM

SK Hynix DDR5 desktop DIMM beside smaller laptop SO-DIMM modules

ROM: Characteristics and Types

ROM keeps its data without power and stores permanent start-up instructions.

TypeHow it is written or erasedTypical use
Mask ROMWritten at the factory; cannot changeMass-produced devices
PROMProgrammed once by burning fusesCustom firmware
EPROMErased with UV light through a quartz windowDevelopment and prototyping
EEPROMErased electrically, byte by byteBIOS chips, settings
FlashErased electrically in blocksSSDs, USB drives, phones

ST M27C160

An EPROM chip with a round quartz window showing the silicon die

Extension · if time permits

ROM Types: Name That Memory!

Read the description, then click the matching ROM type to reveal if you are correct.

Loading...

RAM vs ROM

FeatureRAMROM
VolatilityVolatileNon-volatile
OperationRead and writeMostly read
SpeedFasterSlower
CapacityLargerSmaller
PurposeActive programs and dataFirmware and boot code
Without powerData lostData kept

RAM vs ROM: Attribute Challenge

Each row shows an attribute. Click the correct winner — RAM or ROM.

Attribute RAM ROM
Score: 0 / 0

Memory in a Modern Computer

  • BIOS/UEFI: boot firmware in Flash ROM
  • CPU cache (L1, L2, L3): SRAM
  • System RAM: DDR4 or DDR5 DRAM
  • Storage: SSDs built on Flash memory

Boot sequence: power on → BIOS/UEFI runs from ROM → POST checks the hardware → bootloader and operating system load into RAM → applications run from RAM.

🎬 Watch: What Happens at Power-On

Boot Process: Order the Memory Steps!

Click the steps in the correct order from power-on to OS ready.

Your sequence (click to add):

Buying Tip: How Much RAM?

  • 8 GB is a sensible minimum for office work and study.
  • 16 GB is better for heavy multitasking, design, or programming.
  • Check whether RAM is soldered (no upgrades later) or in a slot.
  • Check the type: DDR4 and DDR5 modules are not interchangeable.

Key Takeaways

  • The memory hierarchy is a pyramid built on a trade-off: Speed vs. Cost vs. Capacity.
  • The levels, from fastest to slowest, are: Registers > Cache > RAM > Secondary Storage.
  • Cache memory is a small, fast buffer that bridges the speed gap between the CPU and RAM.
  • RAM is volatile (temporary workspace, loses data without power), while ROM and Secondary Storage are non-volatile (permanent; ROM holds firmware).
  • SRAM is faster and more expensive than DRAM, so it is used for cache; each DDR generation improves speed and efficiency.
  • Flash memory, a type of EEPROM, is the basis of SSDs and USB drives.

🤔 Discussion Question

Let's Think...

Why don't we just build computers with a very large amount of the fastest type of memory (registers)?

Hint: Think about the trade-offs in the pyramid (Speed, Cost, Capacity).

Exam Practice: Short Answer

  1. What is the memory hierarchy?
  2. Differentiate between RAM and ROM.
  3. Differentiate between SRAM and DRAM.
  4. What is flash memory? Where is it used?

Exam Practice: Long Answer

  1. Explain the memory hierarchy with a diagram, describing each level.
  2. Explain the types of primary memory and their uses.
  3. Explain the types of RAM and ROM.
  4. Describe the role of RAM and ROM in the boot process of a computer.

Revise the The Computer Memory Hierarchy and Types of Computer Memory (RAM and ROM) notes before writing these answers.

Image & Video Credits (1/2)

Images

  • Four-level memory pyramid: course diagram made for IT231 by Arjan KC
  • AMD Zen 5 die with cache labelled: Fritzchens Fritz, CC0, via Wikimedia Commons; labels added for IT231
  • Six-transistor SRAM cell: Inductiveload, public domain, via Wikimedia Commons
  • SK Hynix DDR5 DIMM and SO-DIMM: 4300streetcar, CC BY 4.0, via Wikimedia Commons
  • ST M27C160 EPROM: Javier Pérez Montes, CC BY-SA 4.0, via Wikimedia Commons

Image & Video Credits (2/2)

Videos (YouTube)

  • Branch Education, "How does Computer Cache, Memory, and Storage Work?" (3:45–5:09, 13:59–15:20), https://www.youtube.com/watch?v=TfhL5kBiQVI
  • BitLemon, "SRAM vs DRAM: The Speed Difference between Cache and RAM (Animation)" (0:32–2:01), https://www.youtube.com/watch?v=ammQYLcyebA
  • Dave's Garage, "How Computers BOOT: From Startup to Viruses" (6:21–7:06), https://www.youtube.com/watch?v=rmgla4yeCXw

Teaching content © Arjan KC. Third-party media remain the property of their owners.

Thank You

📖 Read first (chapter notes)