1. Gyanastra
  2. Computer Organisation and Architecture
  3. Cache Basics
  4. Cache Hit, Hit Latency, Cache Miss and Miss Latency
Free lesson, no account needed 4 min read 14 practice questions after it
Asked in past papers9 times
  • GATE CSE202620242022202020192016201520142010

Computer Organisation and Architecture · Cache Basics

Cache Hit, Hit Latency, Cache Miss and Miss Latency

Overview

The memory hierarchy is considered with three levels: cache, main memory and secondary memory.
When the processor needs an instruction or data, it first checks the cache; whether the element is found there or not determines the hit or miss, and the time taken in each case is the hit latency or the miss latency.

Key concepts

  • Memory hierarchy levels: Level 1 is the cache, Level 2 is the main memory (referred to in the context of paging), and Level 3 is the secondary memory.
  • Cache hit: The required element (instruction or data) is found present in the cache when the processor looks into it.
  • Hit latency: The time taken to find out whether the required element is present in the cache or not.
  • Cache miss: The required element (instruction or data) is not present in the cache.
  • Miss latency: The time taken to get the required element from the main memory, place it into the cache, and then get it — that is, the time taken to service the miss.
  • Hit and page fault at the next level: The same hit/miss idea extends to the main-memory level.
    If the required element is present in the main memory it is called a hit; if it is not present in the main memory it is called a page fault.
  • Whether a reference results in a hit or a miss depends on various factors.
Memory diagram: Cache Hit, Hit Latency, Cache Miss and Miss Latency
Figure. Cache Hit, Hit Latency, Cache Miss and Miss Latency

How it works

  1. The processor first looks into the cache (Level 1) for the required element.
  2. If the required element is present in the cache, it is a cache hit. The time spent checking whether it is present or not is the hit latency.
  3. If the required element is not present in the cache, it is a cache miss.
  4. On a cache miss, the required element must be fetched from the main memory, brought into the cache, and then supplied; the total time for this is the miss latency.
  5. The same idea applies at the next level: an element present in main memory is a hit, and an element not present in main memory is a page fault.

Comparison

SituationConditionTermTime involved
Cache levelRequired element present in cacheCache hitHit latency: time to determine whether the element is present in the cache
Cache levelRequired element not present in cacheCache missMiss latency: time to fetch from main memory, place into cache, and then get it
Main-memory levelRequired element present in main memoryHit—
Main-memory levelRequired element not present in main memoryPage fault—

Revision summary

  • Hit latency is only the time to check whether the element is in the cache — not the time to service a miss.
  • Miss latency covers the whole miss service: fetch from main memory, place into cache, then get it.
  • A miss at the cache level is not a page fault; a page fault is the "not present" case at the main-memory level.
  • The hierarchy used is Cache → Main memory → Secondary memory.
  • Hit/miss behaviour depends on various factors, so not every reference is a hit.

Previous-year exam insights

  • Average memory access time (AMAT) = hit time + miss rate × miss penalty;
    for multi-level caches, AMAT = L1 hit time + L1 miss rate × (L2 hit time + L2 miss rate × L2 miss penalty).
    Asked inGATE 2022GATE 2020
  • Miss penalty for a block fetch = block transfer time computed from the number of words in the block and the per-word transfer time (plus any latency to reach the first word);
    the whole block is transferred, not just the requested word.
    Asked inGATE 2020GATE 2019
  • CPU time = (CPIideal\mathrm{CPI}_{\text{ideal}} + memory stall cycles per instruction) × instruction count × clock cycle time, where stall cycles per instruction = (instruction fetch misses per instruction × instruction miss penalty) + (data accesses per instruction × data miss rate × data miss penalty).
    Asked inGATE 2024
  • Speedup from a perfect cache = CPU time with real cache / CPU time with perfect cache = (CPIideal\mathrm{CPI}_{\text{ideal}} + stalls per instruction) / CPIideal\mathrm{CPI}_{\text{ideal}}.
    Asked inGATE 2024
  • In a physically-indexed, physically-tagged cache with a TLB, a TLB miss requires a page-table walk before the physical address is known, so a cache hit cannot be reported before translation succeeds; a page-table miss (page fault) means the page is not in main memory, so a cache hit for that reference is impossible.
    Asked inGATE 2026
  • A cache miss and a page fault are different events at different levels: a cache miss is resolved from main memory, whereas a page fault requires fetching the page from secondary storage (disk), which is far slower.
Pages 1–2 of 2