A CPU cache is a hardware used by the central processing unit (CPU) of a computer to reduce the average cost (time or energy) to access data from the main memory.
Most CPUs have a hierarchy of multiple cache levels with separate instruction-specific and data-specific caches at level 1.
A cache miss is a failed attempt to read or write a piece of data in the cache, which results in a main memory access with much longer latency.
There are three kinds of cache misses:
Locality of reference (principle of locality) is the tendency of a processor to access the same set of memory locations repetitively over a short period of time.
There are two basic types of reference locality:
temporal locality
reuse of specific data and/or resources within a relatively small time duration
spatial locality
(data locality
)
The use of data elements within relatively close storage locations
Sequential locality
, a special case of spatial locality means access data linearly.
One of the three type of cache miss.