Cache

A cache is a hardware or software component that stores certain clusters of data in blocks so future requests from memory to registers for that data can be served much faster. It is based on the principles of:

  • Temporal locality: data that is accessed is likely to be accessed again soon.
  • Spatial locality: data that is accessed or referenced spatially close to each other is likely to be accessed soon.

A cache consists of tag, index, and offset values, which (usually) respectively take up the most significant, middle, and least significant portion of each identifiable -bit memory address. Cache architectures use them to correctly identify the desired data.

A cache can either hit or miss a memory address:

  • A hit occurs when the address is stored inside the cache.
  • A compulsory miss occurs when the data has never been stored inside the cache.
  • A non-compulsory miss occurs when the data has been previously stored in the cache, but has since been replaced.
    • A non-compulsory capacity miss occurs when the cache becomes full and begins forcing out blocks.
    • A non-compulsory conflict miss occurs when the cache has available space, but still forces out a block.