What happens during a cache hit in a computer system?

2023

What happens during a cache hit in a computer system?

  1. A.

    Data is transferred directly to the hard drive

  2. B.

    Data is fetched from main memory into the cache

  3. C.

    Requested data is retrieved directly from the cache memory

  4. D.

    Data is permanently stored in the cache

  5. E.

    The cache memory is cleared

Attempted by 60 students.

Show answer & explanation

Correct answer: C

Concept

A cache is a small, fast memory that sits between the CPU and main memory (RAM) and holds copies of recently or frequently used data. A cache hit occurs when the data the processor requests is already present in the cache, so it can be served from there directly. The opposite event, when the data is not in the cache and must be brought in from a slower level, is a cache miss.

Applying it here

When a cache hit happens, the requested item is found by checking the cache's tags and is read straight out of the cache memory. Because cache is much faster than main memory, this avoids the slower access to RAM and is exactly why caches speed up a system. So the event that defines a cache hit is: the requested data is retrieved directly from the cache memory.

Why the other ideas don't fit

  • Fetching data from main memory into the cache describes what happens on a cache miss (the data was absent and has to be loaded), not on a hit.

  • Transferring data directly to the hard drive is unrelated to cache lookups; the hard drive is secondary storage, not part of the cache access path.

  • Permanently storing data in the cache contradicts how caches work — they are temporary and evict old entries to make room for new ones.

  • Clearing (flushing) the cache is a separate maintenance action; it is not what a successful data request triggers.

Explore the full course: Niacl Ao It Specialist