Cache Memory? Types of Cache Memory? Relation Between Cache and Memory?

Cache memory is a type of high-speed memory that is tiny in capacity but much faster than the main memory in terms of performance (RAM). It can be accessed more quickly by the CPU than the primary memory can. Consequently, it is utilised to synchronise with high-speed CPUs and to boost the performance of those processors.

Cache memory can only be accessed by the computer’s processor. It might be a section of main memory that has been set aside for this purpose or a storage device that is separate from the CPU. It is responsible for storing data and programmes that are often accessed by the CPU. As a result, it ensures that the data is immediately available to the CPU whenever the CPU need it.

In other words, if the CPU finds the data or instructions it requires in the cache memory, it will not need to enter the primary memory (RAM). As a result, by acting as a buffer between the RAM and the CPU, it improves the overall system performance.

Cache memory can be classified into the following types:

  • L1: The first level of cache memory, often known as Level 1 cache or L1 cache, is the most basic level of memory. When using this sort of cache memory, a tiny amount of memory is kept on hand within the CPU. In the case of a CPU with four cores (quad core cpu), each core will be equipped with its own level 1 cache. Because this memory is integrated into the CPU, it is capable of operating at the same speed as the CPU. The size of this memory might be anything from 2KB and 64KB. Aside from that, there are two sorts of caches in the L1 memory: the instruction cache, which stores instructions that the CPU needs, and the data cache, which stores data that the CPU needs.
  • L2: this is the second cache in the hierarchy. This level 2 cache may be located either within or outside of the CPU depending on the configuration. It is possible for all the cores of a CPU to have their own distinct level 2 cache, or for all of the cores to share a single L2 cache. Alternatively, if it is located outside of the CPU, it is connected to the CPU through an extremely high-speed bus. 256 KB to 512 KB of RAM is available in this cache, depending on the model of the computer. They are significantly slower than the L1 cache in terms of performance.
  • L3 cache is sometimes referred to as Level 3 cache or L3 cache. This form of cache is not present in all CPUs; however, some high-end processors may be equipped with this kind of cache. This cache is used to improve the overall performance of the Level 1 and Level 2 caches, respectively. There are several caches that are placed outside of the CPU and are shared by all of the cores of a computer processor. Its memory size spans from 1 MB to 8 MB.

What is the relationship between cache memory and the CPU?

When the CPU requires data, it first checks the L1 cache for the information it requires. If it does not discover anything in the L1 cache, it moves on to the L2 cache and so on. If the data is not found in the L2 cache once again, the search is extended to the L3 cache. An instance of cache hit occurs when data is discovered within the memory of the cache. In contrast, if data is not located within the cache, this condition is referred to as a cache miss.

If data is not available in any of the cache memories, the system seeks for it in the Random Access Memory (RAM) of the computer (RAM). If the RAM does not contain the data, the Hard Disk Drive will be used to obtain the information from the RAM.

In this way, when a computer is started for the first time or when an application is launched for the first time, data in cache memory or RAM is not immediately available. In this situation, the data is obtained by the CPU straight from the hard disc drive (or other storage device). Following that, when you start your computer or launch an application, the CPU may access the data stored in cache memory or random access memory (RAM).






Leave a Reply

Your email address will not be published. Required fields are marked *