Cache Memory

You might also like

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

Cache Memory

What is Cache Memory?

• Also called Cache

• Supplementary memory system that temporarily stores frequently used instructions


and data for quicker processing by the CPU. - (britannica.com)

Basic Cache Operation

The basic idea of caching is when the CPU needs a word, it first looks in the cache. Only
if the word is not there, does it go to main memory.

Cache Design Issues

• Cache Size

• Cache Line Size

• Cache Organization

• Whether instructions and data use the same cache or not

• Unified
• Split

• Number of Caches

• primary cache on chip(split cache integrated with the CPU chip)


• secondary cache off chip but in the same package with the CPU
• we can also have a third cache still farther away

Cache and Memory Writes

• Write through writes back to main memory immediately upon change in the cache
• Write back or write deferred - writes to memory are made only when a cache line is
actually replaced

• Write allocation is a technique employed to handle a write that occurs to a memory


location that is not currently cached

Locality Principle of Caches

Two kinds of address locality to achieve their goal:

a. Spatial Locality – observation that memory locations with addresses numerically


similar to the recently accessed location are likely to be accessed.

b. Temporal Locality – occurs when recently accessed memory locations are accessed
again.

Cache Organization

Several Cache organizations exists:

• Direct-Mapped Caches

• fix the cache entry in which a particular portion of main memory can be stored.
This is the fastest kind of cache to search, but the most inflexible.

• Set-Associative Caches

• caches allow a portion of main memory to be stored in one of several cache


entries. This allows fast retrieval and flexible storage.
• A cache with n possible entries for each address is called an n-way associative
cache.
• A set associative cache is inherently more complicated than a direct-mapped
cache because we need to check up to n tags to see if the needed line is present
in an entry.
• A fully-associative cache allows memory to be stored in any entry of the cache.
Retrieval is very slow, so this organization is not very practical.

You might also like