Hello, I'm Ganesh. I'm building git-lrc, an AI code reviewer that runs on every commit. It is free, unlimited, and source-available on Github. Star git-lrc on GitHub to help more developers discover the project. Do give it a try and share your feedback for improving the product.
Modern computers use multiple storage and memory technologies because no single medium can simultaneously provide massive capacity, ultra-low latency, high bandwidth, and low cost.
Every level of the memory hierarchy represents a tradeoff between these characteristics.
Why is there a memory hierarchy?
This is because each storage technology has its own advantages and disadvantages. We can't use one storage technology for all the purposes.
The main characteristics to consider are:
- Capacity
- Latency
- Bandwidth
- Cost
Each Storage technology is optimized for a specific purpose.
For example:
Imagine you have to travel from one place to another.
You can go with walking, bicycle, car, train, or plane.
Each mode of transport has its own advantages and disadvantages.
Another better example is think of using LLM model.
Depending on task complexity and size of data we can choose the model.
If we mess up with choosing model we will not get the desired output wheather cost will rise, or response will be very low quality.
Memory Hierarchy
Now I have listed down the memory hierarchy From top to bottom.
CPU Registers
This is the fastest storage available inside a processor.
Role:
Stores values currently being operated on by the CPU.
| Characteristic | Value |
|---|---|
| Capacity | Extremely small (typically 32 × 64-bit registers per core) |
| Latency | ~0.3 ns (about one CPU cycle) |
| Bandwidth | Highest in the system |
| Cost | Highest cost per bit (16 transistors per bit) |
CPU Cache (L1, L2, L3)
A small, ultra-fast memory layer designed to keep frequently used data close to the processor.
Role: Reduces the need to access slower main memory.
| Characteristic | Value |
|---|---|
| Capacity | Small (tens of MB total) |
| Latency | ~7.5 ns (L3 cache) |
| Bandwidth | Extremely high |
| Cost | Very expensive (SRAM, 6 transistors per bit) |
DRAM (Main Memory)
The working memory used by applications and operating systems.
Role: Holds active programs and data currently being used.
| Characteristic | Value |
|---|---|
| Capacity | Typically 32 GB |
| Latency | ~45 ns |
| Bandwidth | ~48 GB/s |
| Cost | Higher than storage drives |
GPU VRAM
Memory optimized for throughput rather than low latency.
Role: Feeds large amounts of data to thousands of GPU cores simultaneously.
| Characteristic | Value |
|---|---|
| Capacity | ~24 GB |
| Latency | ~250 ns |
| Bandwidth | Extremely high |
| Cost | Expensive |
NVMe SSD
High-speed solid-state storage connected through PCIe.
Role: Fast persistent storage for operating systems, applications, and files.
| Characteristic | Value |
|---|---|
| Capacity | ~2 TB |
| Read Latency | ~80 μs |
| Write Latency | ~500 μs |
| Bandwidth | ~5 GB/s |
| Cost | ~7 cents per GB |
SATA SSD
An older solid-state storage technology using the SATA interface.
Role: Affordable solid-state storage with lower performance than NVMe.
| Characteristic | Value |
|---|---|
| Capacity | Up to ~4 TB |
| Latency | ~120 μs |
| Bandwidth | Lower than NVMe |
| Cost | Similar to NVMe SSDs |
Hard Disk Drive (HDD)
Mechanical storage using spinning magnetic platters.
Role: Lowest-cost local storage for large datasets and archives.
| Characteristic | Value |
|---|---|
| Capacity | ~8 TB |
| Latency | ~8.3–10 ms |
| Bandwidth | Very low compared to SSDs |
| Cost | ~1–2 cents per GB |
The Fundamental Tradeoff
As we move down the memory hierarchy:
- Capacity increases.
- Cost per GB decreases.
- Latency increases.
- Access speed decreases.
- Distance from the processor increases.
By leveraging this trade-off, modern computers use a hierarchy of registers, cache, memory, SSDs, HDDs, and cloud storage instead of relying on a single storage technology.
Any feedback or contributors are welcome! It’s online, source-available, and ready for anyone to use.
Credits
Here are the sources that inspired me to write an article on this topic.




Top comments (0)