A CDE Definition
locality of reference
Also known as "locality in space" and "spatial locality," it refers to the fact that most instructions in a program are in routines that are executed over and over, and that these routines are in a reasonably confined area. It also refers to data fields in close proximity to each other.
This is the principle behind memory and disk caches, in which data or instructions are placed in higher-speed memory and get read many times before the memory is overwritten by another set. See cache.
(1) To store data locally in order to speed up subsequent retrievals. Pronounced "cash." See Web cache and browser cache.
(2) Reserved areas of memory in every computer that are used to speed up instruction execution, data retrieval and data updating. Pronounced "cash," they serve as staging areas, and their contents are constantly changing. There are two kinds: memory caches and disk caches.
Memory CachesA memory cache, also called a "CPU cache," is a memory bank that bridges main memory and the processor. Comprising faster static RAM (SRAM) chips than the dynamic RAM (DRAM) used for main memory, the cache allows instructions to be executed and data to be read and written at higher speed. Instructions and data are transferred from main memory to the cache in fixed blocks, known as cache "lines," using a look-ahead algorithm. See cache line, static RAM and dynamic RAM.
Temporal and Spatial (Time and Space)
Caches take advantage of "temporal locality," whereby unchanging data constants such as high-low limits, messages and column headers are used over and over again. Caches also benefit from "spatial locality," because the next instruction to be executed or the next set of data to be processed is often next in line. The more sequential they are, the greater the chance for a "cache hit." If the next item is not in the cache, a "cache miss" occurs, and it must be retrieved from slower main memory.
Levels 1, 2 and 3 (L1, L2, L3)
Today's CPU chips contain two or three caches, with L1 being the fastest. Each subsequent cache is slower and larger than L1, and instructions and data are staged from main memory to L3 to L2 to L1 to the processor. On multicore chips, the L3 cache is generally shared among all the processing cores. See write-back cache and write-through cache.
Memory Cache Hierarchy
Disk CachesA disk cache is a dedicated block of memory (RAM) in the computer or in the drive controller that bridges storage and CPU. When the disk or SSD is read, a larger block of data is copied into the cache than is immediately required. If subsequent reads find the data already stored in the cache, there is no need to retrieve it from storage, which is slower to access.
If the cache is used for writing, data are queued up at high speed and then written to storage during idle machine cycles by the caching program or the drive controller. See cache coherency, write-back cache, write-through cache, pipeline burst cache, lookaside cache, inline cache, backside cache and NV cache.
Before/After Your Search Term
Terms By Topic
Click any of the following categories for a list of fundamental terms.