What Is Cache Memory?

In this article, we will understand, what is cache memory in computers and laptop. We will see what is the importance of this cache memory, what is a typical size of this cache memory and what are the different levels of cache memory that we find inside the computers.

What Is A Cache Memory

Before we understand this cache memory, Let's see different kind of memory that we see inside our computers. 

The first kind of memory that we find inside our computer is the non-volatile kind of memory. Like a hard disk drive. This hard disk drive contains mechanically rotating fast disk, which is also known as platters. And if you see any commercially available hard disk drive, the typical rotating speed of the disk is either 5400 or 7200 RPM.

So, as this hard disk drive contains a mechanically rotating part, so in terms of the speed, they are quite slow. So, the typical read or write speed that you get with this hard disk drive is in the range of 80 to 150 MBPS. But if you see the clock speed of the CPU, it is in the range of 1GHz up to the 4 GHz. So, even though the processor is capable of accepting a data much higher speed, but it can't get the data through this hard disk drive at the same rate.

Then it comes to the second kind of memory-Random Access Memory. Random Access Memory is faster compared to the hard disk drive. So it can provide data to the CPU at a much faster rate compared to the Hard disk drive. But still, it slower than the clock speed of the CPU. So, the typical speed of the RAM is in the range of 400 MHz up to the 800 MHz. Still, it is slower than the clock speed of the CPU.

But if you see the newer generations of the RAM like DDR3 and DDR4, then they can operate at much faster rate like 1600 MHz or up to the 2100 MHz that are comparable to the speed of the CPU. Now, you may say that this newer version of RAM can supply data to the CPU at the rate at which they want. But the answer is no. So, the modern day processors which we are using is not single core processor but they are multicore processors. So, this processor could be either dual core, quad core or maybe even octa core. If all the cores are asking for data at the same time, then this RAM can't be able to deliver the data to all the cores at the same time.

Cache memory is fastest among all memories. Cache memory is also Random Access Memory but it is special kind of RAM, which is known as Static RAM. Unlike the Dynamic RAM, which we find inside the normal RAM, this static RAM is quite fast. The typical size of this cache memory is in the range of Kilo Bytes up to the Few Mega Bytes. The data which is frequently required by the CPU can be supplied by this cache memory. So, generally, some instructions and data which is required by the CPU are stored in this cache memory.

What Is Cache Memory L1 L2 L3

Now let's see the different levels of this cache memory.

The first level of a cache memory is known as Level 1 cache or L1 cache.

In this L1 cache, tiny amount of memory is integrated inside the CPU itself. All the cores inside CPU have their individual level 1 cache. As this level 1 cache integrated inside the CPU, so they can operate at the same speed of the CPU. That is the reason why level 1 cache is fastest among all caches. The typical memory size of this level 1 cache is 2KB up to the 64 KB. Inside this level 1 cache, there is two kind of cache. The one is instruction cache and the second is data cache. The instruction cache stores all instructions which are required by the CPU and the data cache stores the data which is required by the CPU.

Now, Let's see the second level of cache. This cache is known as either Level 2 cache or L2 cache. L2 cache could be either inside the CPU or it could be outside the CPU. It  could be separate for all the cores or it could be shared between all cores of the CPU. So, if this level 2 cache is outside the CPU, then it is connected with a very high-speed bus with the CPU. The memory size of this level 2 cache is in the range of 256 KB to the 512 KB. But in terms of the speed, they are slower than the L1 cache. Now, the third kind of cache is known as Level 3 cache. So, all the processors do not have this level 3 cache, but some higher end processors have this level 3 cache. Level 3 cache is used to enhance the performance of this level 1 and level 2 cache. Level 3 cache is shared among all cores. It is outside the CPU. The memory size of this level 3 cache is in the range of 1 MB up to the 8 MB for high end processors. But it is slower than the L1 and L2 cache. But still, it is faster than the Random Access Memory or RAM.

So, now let's see the process flow when CPU needs some data. Whenever CPU needs some data then, first of all, it will look inside the L1 cache. So, if it will not find inside the L1 cache then it will look inside the L2 cache. And if data is inside the L2 cache then it will look into the L3 cache. So, if CPU finds the data inside the cache memory then it is known as a cache hit. But if data is not unavailable inside the cache then it is known as a cache miss.

Suppose if data is not available in the L3 cache, the CPU will look inside the Random Access Memory or RAM. Still, if it doesn't find any data inside the RAM then it will get that data from the Hard Disk Drive. When you are starting your computer for the first time or you are opening some application for the first time, then that data will not be available in either cache memory or in RAM. At that time CPU will get that data from the hard disk drive. Once the application is open and then after if it requires some data then CPU will get that data from either RAM or cache memory.

You may ask that if this cache memory is so fast then why the size of this cache memory is only in Mega Bytes.The reason is that this cache memory is much much costlier than the other memories. And that is the reason you find only a few Mega Bytes of cache memory inside the CPU.

Whenever you are buying some desktop or laptop for yourself, don't only look the Random Access memory but also look how much cache memory that CPU has. Because this cache memory decides the overall performance of the processor. And the same thing is applicable for the smartphone processors as well. So, I hope in this article you understood, what is cache memory and what is the significance of this cache memory inside the computers.

You have successfully subscribed!
This email has been registered