Fundamental of Computer Science
Prepared By:
Dr. Sunil Gupta
Chitkara University Institute of Engineering and
Technology,
Chitkara University, Punjab
Contents
⮚ Memory Hierarchy and Classification
⮚ Layers of Memory
⮚ Volatile and Non-Volatile Memory
⮚ RAM Types
⮚ ROM Types
Memory Hierarchy
The Memory Hierarchy is an arrangement of different types of computer
memory based on:
Cost per bit
Size/Capacity (how much data can be stored)
Access Speed (how fast data can be read/written)
Rule:
Faster memory → Smaller size → Higher cost per GB
Slower memory → Larger size → Cheaper per GB
Memory Hierarchy
General Order (Fastest → Slowest):
CPU Registers
Cache Memory (L1 → L2 → L3)
Main Memory (RAM)
Secondary Storage (HDD, SSD)
Tertiary Storage (optical discs, tapes, cloud backups)
Registers
Definition: Smallest and fastest memory storage locations inside the CPU.
Volatile – data is lost when power is off.
Purpose: Stores:
Current instruction
Memory addresses
Intermediate calculation results
Size: Few bytes to a few KB only.
Examples:
Program Counter (PC) – Holds the address of the next instruction.
Instruction Register (IR) – Holds the currently executing instruction.
Accumulator (ACC) – Holds data being processed by ALU.
Status Register / Flags – Stores status info (zero, carry, sign flags).
Cache Memory
Definition: A small, high-speed memory located between the CPU and main
memory (RAM).
Purpose: Stores frequently accessed instructions and data so CPU does
not have to fetch them from slower RAM repeatedly.
Volatile – data is lost when power is off.
Levels:
L1 Cache: Smallest (e.g., 32–128 KB), fastest, built inside CPU core.
L2 Cache: Larger (e.g., 256 KB–1 MB), slightly slower, can be inside
CPU or separate chip.
L3 Cache: Largest (e.g., 2–50 MB), slower than L1/L2, shared by
multiple cores.
Benefit: Reduces CPU idle time, increases performance.
RAM
Main Memory (RAM)
Definition: The main working memory that temporarily stores data and
programs currently being executed.
Volatile – data is lost when power is off.
Access: Directly accessible by CPU.
Capacity: GB range (4 GB, 8 GB, 16 GB, etc.)
A computer’s motherboard is designed in a manner that the memory capacity
can be enhanced by adding more memory chips
The additional RAM chips, which plug into special sockets on the
motherboard, are known as single-in-line memory modules (SIMMs)
Types of RAM
● SRAM (Static RAM)
● DRAM (Dynamic RAM)
SRAM (Static RAM)
🔹 SRAM (Static RAM)
● Full form: Static Random Access Memory
● Works by: Using flip-flops (circuits that hold data as long as power is
on).
● Speed: Very fast ⏩
● Cost: Expensive 💲💲
● Power use: Low (doesn’t need refreshing)
● Use: Inside CPU as cache memory (L1, L2, L3).
● Size: Smaller in capacity.
DRAM (Dynamic RAM)
● Full form: Dynamic Random Access Memory
● Works by: Using capacitors (store charge but leak → must be refreshed
often).
● Speed: Slower than SRAM ⏳
● Cost: Cheaper 💲
● Power use: Higher (needs constant refreshing).
● Use: Main memory (system RAM) in computers.
● Size: Larger in capacity.
ROM
ROM (Read-Only Memory)
Definition: Non-volatile memory that stores permanent data or
firmware (firmware is essentially a software embedded
within a hardware device that controls its basic functions).
Data remains even when power is off.
Purpose: Stores essential startup instructions for the computer
(BIOS firmware).
Types of ROM
PROM (Programmable ROM)
Blank when manufactured.
Can be programmed once by the user.
Data cannot be changed later.
EPROM (Erasable Programmable ROM)
Can be erased by ultraviolet (UV) light.
Can be reprogrammed after erasing.
EEPROM (Electrically Erasable Programmable ROM)
Can be erased and reprogrammed electrically.
Allows selective byte-by-byte erasing.
Flash Memory
Fast, reprogrammable.
Used in SSDs, USB drives, memory cards.
Can erase and write in blocks.
Secondary Storage
Definition: Non-volatile storage used for long-term data storage.
Examples:
HDD (Hard Disk Drive):
Magnetic storage.
Large capacity (TBs).
Slower than SSD.
SSD (Solid State Drive):
No moving parts.
Much faster than HDD.
More expensive.
Optical Discs: CD, DVD, Blu-ray.
External Drives and Cloud Storage.
Tertiary Storage
Used for backups and archiving.
Examples: cloud backup servers.
Difference between Volatile and Non-
Volatile Memory