OS loads data from Secondary Memory to RAM and then Blocks of main memory are map to cache lines. This process called the cache mapping.
The main memory is divide into no. of blocks and Cache memory divided into no. of lines. The block size of the main memory is equal to the line size of the cache memory.
Need of Cache
CPU works in GIPS (Gaga instruction per second) or MISP (Mega instruction per second), While Main memory works in millisecond per second
(CPU 1hr= HD 10lakh hour)
So to maintain speed we use RAM, Cache and registers. We don’t use all memory as RAM because it is too costly.
How Blocks of Main Memory are fit into Lines of Cache?
There are three basic types of cache mapping which are explain below
- Direct Mapping
- Fully associative mapping
- K-way Set associative
We will explain all with examples in the next lectures