Cache Line
Subject: Computer and Technology noun /ˈkæʃ ˌlaɪn/ 1 definition
- computer-architecture
- cpu-design
- memory-management
- computer-hardware
-
Definition (noun)
Entry #353 · UpdatedA Cache Line (also called a cache block) is the fixed-size, naturally aligned chunk of contiguous memory—commonly 64 bytes on x86-64 processors and 64 or 128 bytes on ARM64 systems—that serves as the atomic unit of storage, transfer, and coherence in a CPU cache. Rather than tracking individual bytes or words, a cache controller maps each memory address to an enclosing line slot and fetches the entire block from lower cache tiers or DRAM on a cache miss, storing its payload alongside metadata such as an address tag, valid flag, and dirty or coherence state bits. Operating at line granularity exploits spatial locality so sequential or nearby accesses hit in fast on-die SRAM while keeping tag-lookup hardware compact. Because eviction, write-back, and inter-core coherence protocols act on whole lines rather than individual fields, aligned data layouts and padding at cache-line boundaries are critical to avoid wasted memory bandwidth and false sharing in concurrent software.
Common Types
Standard Uniform Cache Line: Associates a single address tag and coherence state with one contiguous data block (typically 64 or 128 bytes), transferring and invalidating the full block atomically on misses, write-backs, and coherence events.
Sectored (Sub-Blocked) Cache Line: Shares one address tag across multiple smaller sub-blocks—each with independent valid and dirty bits—to reduce tag-array SRAM overhead while fetching only requested sectors for sparse workloads such as GPU memory accesses.
Compressed Cache Line: Encodes predictable data patterns (such as all-zero blocks or narrow value deltas) into compact segments within a decoupled tag-and-data array, packing multiple logical lines into fewer physical SRAM slots to expand effective cache capacity.
Example
On an x86-64 processor with 64-byte cache lines, reading a 4-byte
int32_telementarr[0]at aligned address0x1000after a cache miss pulls the entire line (0x1000–0x103F) from DRAM into the L1 data cache, turning subsequent reads ofarr[1]througharr[15]into fast L1 hits. Conversely, if two threads on different cores concurrently increment adjacentstd::atomic<uint64_t>counters at0x1000and0x1008, both counters occupy the same cache line, causing coherence invalidations (false sharing) until separated onto distinct lines withalignas(64).