Cache Management

Computer ScienceMCAOperating System

Cache is a type of memory that is used to increase the speed of data access. Normally, the data required for any process resides in the main memory. However, it is transferred to the cache memory temporarily if it is used frequently enough.

A diagram to better understand the data transfer in cache management is as follows −

Cache Performance

The cache performance can be explained using the following steps −

  • If a process needs some data, it first searches in the cache memory. If the data is available in the cache, this is termed as a cache hit and the data is accessed as required.
  • If the data is not in the cache then it is termed as a cache miss. Then the data is obtained from the main memory. After that the data is transferred to the cache memory under the assumption that it will be needed again.
  • The performance of the cache is measured using the hit ratio. It is the number of cache hits divided by the total cache accesses. The formula for this is:

Types of Cache Memory

There are mainly two types of cache memory i.e. primary cache and secondary cache. These are explained in detail as follows −

Primary Cache

Primary cache is very fast and its access time is similar to the processor registers. This is because it is built onto the processor chip. However because of this reason, its size is quite small. It is also known as a level 1 cache and is build using static RAM (SRAM).

Secondary Cache

The secondary cache or external cache is cache memory that is external to the primary cache. It is located between the primary cache and the main memory. It is also known as a level 2 cache and is often housed on the processor chip as well.

Advantages of Cache Memory

Some of the advantages of cache memory are as follows −

  • Cache memory is faster than main memory as it is located on the processor chip itself. Its speed is comparable to the processor registers and so frequently required data is stored in the cache memory.
  • The memory access time is considerably less for cache memory as it is quite fast. This leads to faster execution of any process.
  • The cache memory can store data temporarily as long as it is frequently required. After the use of any data has ended, it can be removed from the cache and replaced by new data from the main memory.

Disadvantages of Cache Memory

Some of the disadvantages of cache memory are as follows −

  • Since the cache memory is quite fast, it is extremely useful in any computer system. However, it is also quite expensive and so is used judiciously.
  • The cache is memory expensive as observed from the previous point. Also, it is located directly on the processor chip. Because of these reasons, it has a limited capacity and is much smaller than main memory.
Published on 16-Aug-2018 11:16:51