Cache Memory Unit-4
Cache Memory Unit-4
memory volatile
computer memory that provides high-speed data
access to a processor and stores frequently used
computer programs, applications and data. It stores
and retains data only until a computer is powered
up.
⮚ Small amount of fast memory
⮚ Sits between normal main memory and
CPU
⮚ May be located on CPU chip or module
Address
Address
buffer
Control Control System
bus
Data
buffer
Data
⮚ The CPU initially looks in the Cache for the data it needs
⮚ If the data is there, it will retrieve it and process it
⮚ If the data is not there, then the CPU accesses the system memory
and then puts a copy of the new data in the cache before processing
it
⮚ Next time if the CPU needs to access the same data again, it will just
retrieve the data from the Cache instead of going through the whole
loading process again
Level 1(L1) Cache:
⮚ L1-cache is the fastest cache and it usually comes within the
processor chip itself.
⮚ The L1 cache typically ranges in size from 8KB to 64KB and uses
the high-speed SRAM (static RAM) instead of the slower and
cheaper DRAM (dynamic RAM) used for main memory.
⮚ It is referred to as internal cache or primary cache.
Level 2(L2) Cache:
⮚ The L2 cache is larger but slower in speed than L1 cache.
⮚ store recently accessed information. Also known as secondary
cache, it is designed to reduce the time needed to access data in
cases where data has already been accessed previously.
⮚ L2 cache comes between L1 and RAM(processor-L1-L2-RAM) and is
bigger than the primary cache (typically 64KB to 4MB).
Level 3(L3) Cache:
⮚ L3 Cache memory is an enhanced form of memory present on the
motherboard of the computer.
⮚ L3, cache is a memory cache that is built into the motherboard. It
is used to feed the L2 cache, and is typically faster than the
system’s main memory, but still slower than the L2 cache, having
more than 3 MB of storage in it.
Commonly used methods:
⮚ Direct-Mapped Cache
⮚ Associative Mapped Cache
⮚ Set-Associative Mapped Cache
⮚ Each block of main memory maps to only one cache line
⮚ i.e. if a block is in cache, it must be in one specific place
⮚ Address is in two parts
⮚ Least Significant w bits identify unique word
⮚ Most Significant s bits specify one memory block
⮚ The MSBs are split into a cache line field r and a tag of s-r
(most significant)
Tag s-r Line or Slot r Word w
8 14 2