Cache

image

Cache is a fast memory, act as buffer between CPU and MM.

CPU first checks cache, then main memory and finally system memory.
A subset of the code and data that is frequently used is stored in cache.

Principle of Locality

When a byte of code/data is accessed in a program, it is very likely that nearby code or data will be needed soon.

Direct mapped cache