Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

What is Cache Memory: -

Cache memory is a small-sized type of volatile computer memory that provides


high-speed data access to a processor and stores frequently used computer
programs, applications, and data. It acts as a temporary storage of memory,
making data retrieval easier and more efficient. Cache operates on the principle
of locality, storing frequently accessed information closer to the CPU to reduce
access times. It is the fastest memory in a computer, typically integrated onto
the motherboard and directly embedded in the processor or main random-access
memory (RAM).
What is cache optimization: -

Cache optimization encompasses a spectrum of techniques, from fundamental


principles like cache organization to advanced strategies such as multi-level
caching and prefetching. These methods collectively aim to minimize cache
misses, thereby reducing latency and enhancing system efficiency. By
optimizing cache access patterns, data retrieval is expedited, leading to
improved system responsiveness. Moreover, these optimizations contribute to
conserving energy and maximizing throughput in modern computing
environments. Overall, cache optimization plays a critical role in ensuring
optimal system performance, effectively meeting the demands of diverse
applications and workloads.
Basic Techniques: -
Larger Block size: -Optimal block size depends on latency and bandwidth of lower-level
memory. High bandwidth and high latency encourage large blocks. Low bandwidth and low
latency encourage small blocks.
Small and simple caches: This technique is used to reduce the miss time, If lesser hardware
is required for the implementation of caches, then it decreases the Hit time because of the
shorter critical path through the Hardware.
Larger cache size: This technique is used to reduce the miss rate by increasing the cache
size, thereby decreasing the miss rate. But they increase the hit time and power consumption.
Multi-Level Caches: This technique is used to reduce miss penalty let us consider a two-
level cache. The first level cache is smaller in size and has faster clock cycles comparable to
that of the CPU. Second-level cache is larger than the first-level cache but has faster clock
cycles compared to that of main memory.
Advance Techniques: -

Compiler-Controlled Prefetching to Reduce Miss Penalty or Miss Rate – Compiler can


also insert prefetch instructions to request data before the processor needs it. There are two
Flavors of prefetch, register prefetch will load the value into a register and Cache prefetch
loads data only into the cache and not the register.

Way prediction and pseudo associativity: This is another approach that reduces conflict
misses and maintains the hit speed of direct-mapped caches. In this case, extra bits are kept in
the cache, called block predictor bits, to predict the way, or block within the set of the next
cache access.

Critical Word First and Early Restart to Reduce Miss Penalty -


Critical word first: Request the missed word first from memory and send it to the processor
as soon as it arrives; let the processor continue execution while filling the rest of the words in
the block.
Early restart: Fetch the words in normal order, but as soon as the requested
word of the block arrives send it to the processor and let the processor continue execution.

Blocking: - This optimization improves temporal locality to reduce misses. Instead of


operating on entire rows or columns of an array, blocked algorithms operate on submatrices
or blocks. The goal is to maximize accesses to the data loaded into the cache before the data
are replaced.

You might also like