Cost Per Byte Analysis
You'll learn: How the price you pay for each byte of storage decreases dramatically as you move from fast, tiny memory near the CPU to slower, larger storage farther away.
The Economics of the Memory Hierarchy
In the previous lesson, you learned that different levels of the memory hierarchy trade speed for capacity. Now let's look at the financial side of this tradeoff: cost per byte.
The storage closest to the CPU—registers and cache—is built from extremely fast but expensive technology (SRAM). A single byte in a CPU register might cost thousands of times more than a byte on a hard drive!
The Cost Pyramid
Here's roughly how cost per byte scales across the hierarchy (from most to least expensive):
- Registers: Most expensive per byte—but you only have a few dozen bytes total
- Cache (L1, L2, L3): Very expensive—measured in kilobytes to megabytes
- Main Memory (RAM): Moderate cost—measured in gigabytes
- SSD Storage: Lower cost—hundreds of gigabytes to terabytes
- Hard Disk Drives: Least expensive—multiple terabytes
The Practical Analogy
Think of it like real estate: a square foot in a penthouse apartment in Manhattan costs far more than a square foot in a warehouse in rural Kansas. You keep your most valuable, frequently-accessed items (data) in the expensive "penthouses" (registers/cache), and bulk items in the cheap "warehouses" (disk storage).
This cost structure is why the memory hierarchy exists—it would be impossibly expensive to build terabytes of register-speed storage!
Key Takeaway: Cost per byte drops by orders of magnitude as you descend the memory hierarchy, making it economically necessary to use a mix of small-fast-expensive and large-slow-cheap storage technologies.