Cache Mapping

OS loads data from Secondary Memory to RAM, and then main memory blocks are mapped to cache lines. This process is called cache mapping.

The main memory is divided 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 milliseconds 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 do Blocks of Main Memory fit into Lines of Cache?

There are three basic types of cache mapping, which are explained below

  1. Direct Mapping
  2. Fully associative mapping
  3. K-way Set associative

We will explain all with examples in the next lectures