Main memory (DRAM) is large but slow compared with a processor. A cache is a small, fast memory, built from SRAM, that sits between them and keeps copies of the data the processor used recently.
It works because programs tend to reuse the same data and to use data near what they just used. So:
- a hit: the data is already in the cache, and the processor gets it quickly
- a miss: the data must come from main memory, which takes much longer; a copy is then kept in the cache
The average access time depends on how often you hit:
average time = hit time + miss rate × miss penalty
With a good hit rate, the system feels almost as fast as the cache and almost as big as main memory.
Why SRAM? Speed, and no refresh. Its lower memory density doesn't matter much, because a cache only needs to be small.