Home

HardwareCaches

HardwareCaches refer to the small, fast memories that are integrated into or very close to a processor to speed up data access by keeping copies of frequently used data and instructions from main memory. They exploit temporal locality (repeated access to recently used items) and spatial locality (nearby data accessed together) to reduce average memory latency.

In modern systems, caches are organized in a hierarchy, commonly labeled L1, L2, and L3. L1 caches

Cache coherence is essential in multi-core and multi-processor systems. Coherence protocols, for example MESI, ensure that

Performance depends on hit rates, miss penalties, and the balance of cache sizes, access latency, and bandwidth.

are
the
smallest
and
fastest,
often
split
into
separate
instruction
and
data
caches
per
core.
L2
is
larger
and
slower,
while
L3
is
larger
still
and
may
be
shared
among
multiple
cores.
Cache
lines,
the
unit
of
transfer
between
memory
and
caches,
are
typically
tens
of
bytes
long.
During
execution,
a
request
is
checked
against
the
cache
hierarchy;
a
cache
hit
delivers
data
quickly,
while
a
miss
requires
fetching
data
from
a
lower
level
or
main
memory,
potentially
replacing
an
existing
line
according
to
a
replacement
policy
such
as
LRU.
all
caches
observe
a
consistent
view
of
memory.
Cache
organization
can
be
inclusive,
where
upper-level
caches
hold
copies
of
lines
present
in
lower
levels,
or
exclusive,
where
data
resides
in
only
one
level
at
a
time.
Write
policies
vary:
write-back
caches
delay
writes
to
lower
levels,
while
write-through
caches
write
data
to
memory
immediately.
Write-allocate
versus
no-write-allocate
determines
whether
a
write
miss
brings
the
line
into
the
cache.
Hardware
caches
are
a
central
component
of
the
memory
hierarchy,
shaping
overall
system
performance
and
energy
efficiency.