Course contentsShow
← Computer Science
Lesson 1138 of 2,87226. Memory Hierarchy and CachingFree lesson

Cache Hit and Miss Definitions

Define cache hits, cache misses, and how they impact overall system performance and memory access time.

Cache Hit and Miss Definitions

What you'll learn: You'll understand exactly what cache hits and misses are and why they matter for your computer's speed.


What Is a Cache Hit?

A cache hit occurs when the CPU looks for data in the cache and finds it there. This is the best-case scenario! The processor gets the data quickly from fast cache memory without needing to access slower main memory (RAM).

Think of it like checking your desk drawer for a pen—if it's right there, you grab it instantly.

What Is a Cache Miss?

A cache miss happens when the CPU looks for data in the cache but doesn't find it. Now the system must fetch the data from slower main memory, which takes significantly longer. After retrieving it, the data is typically loaded into the cache for potential future use.

This is like realizing the pen isn't in your desk drawer, so you have to walk across the room to the supply cabinet.

Impact on System Performance

Cache hits and misses directly determine effective access time—the average time it takes to retrieve data:

  • More hits = faster program execution, better performance
  • More misses = slower execution due to frequent main memory access (the "miss penalty")

The hit rate (percentage of accesses that are hits) is a key metric. Even a small improvement—say from 90% to 95%—can dramatically speed up your system because you're avoiding many slow memory trips.

Cache effectiveness relies on the principle of locality you've learned: programs that reuse data (temporal locality) and access nearby addresses (spatial locality) achieve higher hit rates.


Key Takeaway: A cache hit means data was found in fast cache memory, while a cache miss means fetching from slow main memory—maximizing hits is essential for high-performance computing.