Memory Hierarchy
Memory Hierarchy
Hierarchy in
Computer
Fundamentals
Computer systems use a hierarchy of memory components to store
and access data efficiently. This memory hierarchy comprises
different storage levels, each with unique characteristics, capacity,
and speed.
by Rasia Bashir
Introduction to Memory Hierarchy
1 Registers
Registers are the fastest memory components, located directly on the CPU, holding data actively processed.
2 Cache Memory
Cache is a small, fast memory that stores frequently accessed data, speeding up access by minimizing trips to slower main memory.
4 Secondary Storage
Hard disks and SSDs provide long-term storage for data and programs, slower than RAM, but more persistent.
5 Tertiary Storage
Tape drives offer large-capacity storage for backups and archiving, slowest but most cost-effective.
Registers
Fastest Memory Limited Capacity Direct CPU Access
Registers are the fastest type of Registers are small and can only Data held in registers can be
memory, residing directly inside store a limited amount of data, accessed directly by the CPU
the CPU, providing extremely low typically only holding data without any delays, crucial for
latency for data access. actively being processed by the high-speed computations.
CPU.
Cache Memory
1 Faster Access 2 Levels of Cache
Cache is a small, fast Most modern CPUs have
memory that stores multiple levels of cache
frequently accessed data, (L1, L2, L3), each with
reducing access time by increasing size and
minimizing trips to slower latency, but still faster
main memory. than main memory.
3 Cache Management
Cache controllers use sophisticated algorithms to determine
which data to keep in cache and which to discard to
maintain performance.
Main Memory (RAM)
Primary Storage Volatile Memory Larger Capacity
RAM is the primary storage for RAM is volatile, meaning data RAM has a much larger capacity
active programs and data, stored in it is lost when power is than cache, allowing it to store
accessed directly by the CPU, but turned off. more data and programs.
slower than cache.
Secondary Storage (Hard Disk, SSD)
Hard Disk Drives (HDDs)
HDDs store data magnetically on spinning platters, slower than SSDs but more affordable for large storage capacities.
Non-Volatile Storage
Both HDDs and SSDs are non-volatile, meaning data is retained even when power is off.
Tertiary Storage (Tape
Drives)
Type Capacity Speed Cost
Speed
Registers are the fastest, followed by cache, RAM, secondary storage, and tertiary storage.
Capacity
Registers have the smallest capacity, followed by cache, RAM, secondary storage, and
tertiary storage.
Cost
Registers are the most expensive per unit of storage, followed by cache, RAM, secondary
storage, and tertiary storage.
Tradeoffs in Memory
Hierarchy Design
1 Speed vs. Capacity 2 Cost vs. Performance
Faster memory is typically Using a hierarchy allows
more expensive and has for a balance between
lower capacity. cost and performance,
leveraging cheaper but
slower storage for less
frequently accessed data.
3 Data Locality
Effective cache utilization relies on data locality, where
frequently accessed data is clustered together, enhancing
performance.
Importance of Memory
Hierarchy in Computer
Performance
Reduced Latency Increased Throughput
The hierarchy reduces The hierarchy increases
latency by minimizing the throughput by allowing
time it takes to retrieve more data to be processed
data. in a given time.