What is Compulsory miss?

A cache miss that inevitably occurs on the first access to data. A larger cache does not reduce it, but larger lines or prefetching can.

Field: Memory Hierarchy

Japanese name: 初期参照ミス

Its place among the three kinds of miss

Cache misses are classified into three kinds by cause: compulsory misses, which occur because data is touched for the first time; capacity misses, which occur because the cache is too small; and conflict misses, which occur because data competes for the same place. Of these, compulsory misses occur even in an infinitely large cache, because data that has never been read cannot already be in it. They are frequent just after a program starts and when it enters a new region of data.

How to reduce them

The first method is to make the cache line larger, because one miss then brings in the neighboring data as well. With 64-byte lines, reading an array of 8-byte elements in order misses only once every 8 elements. If the line is made too large, however, fewer lines fit in the same capacity and other misses increase. The second method is prefetching. The processor detects regularity in the accesses, such as addresses increasing in sequence, and reads data in before it is used. A program can also use instructions that request a prefetch.

Where they stand out

In processing that reads a very large array just once from beginning to end, almost all misses are compulsory. Enlarging the cache does not speed this up. What helps is prefetching and the rate at which data can be brought from memory. Laying data out at consecutive addresses as far as possible lets prefetching work well.

Try it: questions about Compulsory miss

Which correctly lists the "three Cs" classification of cache misses?

  1. AWrite, read and branch misses
  2. BClock, voltage and temperature misses
  3. CCompulsory, capacity and conflict misses
Show answer and explanation

Answer: C. Compulsory, capacity and conflict misses

Cache misses are classified as compulsory (first access), capacity (evicted because the cache is too small) and conflict (competition for the same set). Remedies differ by cause: larger lines or prefetching for compulsory misses, a bigger cache for capacity misses, and higher associativity for conflict misses.

In a direct-mapped cache, elements of two arrays map to the same cache location and evict each other on every alternating access. How is this miss classified?

  1. ACompulsory miss
  2. BCapacity miss
  3. CConflict miss
Show answer and explanation

Answer: C. Conflict miss

Misses where two pieces of data fight over the same set and evict each other, even though the cache as a whole has room, are conflict misses. Raising associativity so a set can hold both, or offsetting one array so it maps to different sets, reduces them. Capacity misses arise because the working set exceeds the whole cache and persist even with full associativity. Compulsory misses happen on first access and do not describe repeated accesses.

FAQ

Is a cold miss the same thing?

Yes. It is sometimes called that in the sense of a miss that occurs while the cache is cold, that is, still empty.

What is a miss on the second access to the same data?

It is not a compulsory miss. It occurs because data that was once loaded has been evicted, so it is a capacity miss or a conflict miss.

Questions that mention Compulsory miss (3)

Compulsory miss appears in 5 practice questions across 2 topics, including Memory Hierarchy, CPUs and architecture.

  1. Which method is effective at reducing the cache misses that occur when a program accesses data for the first time?
  2. What is the effect of increasing a cache's line size?
  3. What is the main effect of a victim cache, a small fully associative buffer that temporarily holds lines evicted from the L1 cache?

Books on Memory Hierarchy Ad

As an Amazon Associate I earn from qualifying purchases.

This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.

Back to the glossary