Cache Memory is a static RAM that can be accessed easily and quickly by the processor. The more frequently used data is stored in cache memory. Hence if the processor is accessing the data it looks into the cache memory.
If the data is available in the cache memory then it can be retrieved from the cache memory easily and it is not necessary to access the main memory which may take more time. The cache memory can be illustrated as follow-
The cache memory concept can be explained easily be an example. Consider a telephone directory which the telephone number of all the users in a city. When a Peron wants to call any of the telephone users, then he looks into the telephone directories, searches for a particular user, and then gets the telephone number.
The person then makes a note of the number in his telephone index book. the next time if the person wants to make calls to the same person then he does not spend time looking into the telephone find his telephone number rather searches easily in the telephone index book to get the telephone number.
The person trying to call is compared to a processor and the big telephone directory is compared to the RAM and the small telephone index book is compared to the cache memory.
The Processor stores the more frequently us3ed data onto the cache memory and hence the accessing speed can be improved. Moreover, cache memory is made of SRAM which increases the speed of access. Cache memory is limited in size and is expensive.
The hierarchy lit given below shows the speed of access. The speed decreases as we traverse downwards.
- L1 Cache
- L2 Cache
- Disk Cache
- Optical Storage
Level 1 (L1) Cache Memory
Level 1 cache memory is also called primary cache and is inbuilt in the microprocessor. Level cache 1 is the fastest cache memory since it can be easily accessible by the CPU.
In the figure below, the number of data transferred between the registers and the L1 cache is shown with many arrow marks which indicate that the data transfer is the fastest. The capacity of the L1 cache is less when compared to the L2 cache or RAM as shown in the figure below.
The peed of data transfer between the L2 cache and the L1 cache is comparatively low which is given by fewer arrow marks in the figure below. However, the capacity of the L2 cache is greater than L1 Cache. The speed of data transfer between the RAM and the L2 cache is still less but the storage capacity of RAM is greater than L1 and L2 cache.
Level 2 (L2) Cache Memory
Level 2 cache memory is also called secondary cache and is present as a separate chip on the motherboard. The main difference between the Celeron and the Pentium processors is the presence of greater cache memory.
Level 3 Cache Memory
With the advancement in technology, many processors included L2 caches which their architecture. Level 3 cache is an extra cache memory that can interface between the main memory and the processor.