Choose Your Language
What is Cache Memory Full Detail in Computer | HARTRON EXAM

What is Cache Memory Full Detail in Computer

What is Cache Memory in simple words

What is Cache Memory Full Detail in Computer
What is Cache Memory Full Detail in Computer

What is cache memory? It is very easy to understand. We all know that the work of running a program in a computer is done by the CPU (Central Processing Unit). To do this work, he needs many instructions and data. Often these things are stored in Random Access Memory (RAM) or Hard Disk.

Now because CPU works very fast, in comparison to which RAM and hard disk are very slow. Because of this, it takes a lot of time for the CPU to get these instructions and data. Which has a bad effect on the overall performance of the computer system. To avoid this, “Cache Memory” is used in all modern computers.

Although the data storage capacity of cache memory is very less. But it is the fastest compared to the rest of the computer memory. So the cache memory is used to store the instructions and data that the CPU needs again and again.

In this post what is cache memory, we will know further what is the importance of cache memory in computer, what are the benefits of cache memory and where is cache memory located? But before that what is called cache memory? Let’s understand it in a little detail.

Topics

  • What is Cache Memory? (What is Cache Memory)
  • Importance of Cache Memory in Computer
  • How Cache Memory Works – How Cache Memory Works?
  • What is Cache Mapping?
  • Different Levels in Cache Memory
  • where is the cache memory located
  • Conclusion

What is Cache Memory

Cache memory is a volatile computer memory, in which the frequently used instructions or data are stored by the CPU. It is very small memory i.e. not much data can be stored in it. But it is considered to be the fastest memory because it is located very close to the CPU chip. It is used to reduce the average time taken to access the data from the main memory.

It is more expensive than RAM and Disk memory. Also the closest is to the CPU. This is the reason why the CPU accesses the data stored in the cache memory the fastest. So Cache Memory is a very high speed semiconductor memory, which holds the frequently used data to speed-up the CPU. It acts as a buffer between CPU and main memory.

Most modern computers have at least three types of cache memory: the instruction cache, which accelerates the fetching of executable instructions, the data cache, which accelerates the fetch and store data. In Translation lookaside buffer (TLB) it is used to speed up virtual-to-physical address translation of both executable instructions and data.

Importance of Cache Memory in Computer

The performance of the system matters a lot to a computer user. As we know, for this it is necessary for the CPU to be faster and more efficient. That is, the faster and more efficient the CPU will do a process, the better will be the performance of the computer. So the cache memory in a way improves the efficiency of the CPU. From some important points mentioned below, you can understand the importance or importance of Cache Memory.

1) Due to slow down of main memory, CPU slows down the overall process of program execution. Whereas using Cache memory speeds up the process.

2) Cache memory holds those instructions / data, which are needed by the CPU frequently or they are very common. Due to which the CPU does not have to go to the main memory for the required data. In this way, the cache memory practically acts as a buffer between the CPU and RAM.

3) Cache memory is the fastest access memory as compared to RAM, because it is present in the CPU chip itself. By which the CPU gets the necessary instructions quickly.

4) The data stored in the cache memory is temporary. This means that when the stored data is of no use, it is absolutely useless, then it gets replaced immediately.

5) Its throughput (amount of data passing through a system) is high as compared to the rest of the memory. Because Cache memory uses the back-side-bus to connect to the CPU core. Whose width is about 128 bit and up to 256 bit. The higher the width of the bus, the limit for data transfer at a time will increase.

How Cache Memory Works

How Cache Memory Works
How Cache Memory Works

You have come to know that what is Cache Memory and what is its role in computer. Let us now see that when you run any application / program in your computer, then what is the role of Cache Memory here. Whenever you run a program, it is usually stored in the hard disk.

Now because the CPU cannot fetch data directly from the hard disk because it is very slow. Due to which the program has to be loaded into the RAM memory. Because RAM is much faster than a hard disk. However, the problem here is that even RAM is not as fast as CPU. The data transfer speed and access time (latency) of RAM is much less than that of CPU.

So when CPU requests a program from RAM, RAM takes a certain amount of time to deliver it. Due to which the CPU has to wait for that much time. Due to this, its overall performance is reduced to a great extent. To avoid this, cache memory is used in computers.

They take data/instructions from some memory addresses in RAM and make a backup in their cache memory. After which the CPU reads the cache memory before retrieving data from RAM or hard disk. If the data is present there, the CPU will retrieve it instantly. If the requested data/instructions is not found in the CPU cache, then it will have to retrieve the data from the hard drive again.

This will take more time because the processing time is already lost in searching the data in the cache memory. However, processing speed can be improved with the help of multiple cache layers. These two conditions are defined as Cache Hit and Cache Miss. Let’s know about them.

Cache Hit: This is the situation when the data requested by the CPU is found (found) in the cache memory.

Cache Miss: In this case the data requested by the CPU is not found in the cache memory.

What is Cache Mapping

Cache Mapping is a technique under which the requested content is mapped from the main memory to the cache in the event of a cache miss. In simple words, if the CPU does not get the content that it needs in the cache memory, then the process of finding that content in the main memory and bringing it back to the cache memory is called Cache Mapping. Cache mapping is done using three different types of techniques which are as follows.

  • Direct Mapping
  • Fully Associative Mapping
  • Set Associative Mapping

Direct Mapping

As the name suggests, the Direct Mapped Cache has a fixed cache memory locations for each block to be mapped. That is, it is fixed in which cache line a main memory block is to be kept.

Fully Associative Mapping

Although its structure is quite similar to direct mapping. But in fully associative mapping a memory block can be mapped to any cache line instead of a fixed location.

Set Associative Mapping

It is seen as a combination of direct mapping and associative mapping. In which the cache lines are divided into sets. Where each set contains a k-number of lines. In this a particular block of main memory can be mapped to a particular set of cache memory. However, within that set the memory block can be mapped to any cache line. Hence it is sometimes also called K-way Set Associative Mapping.

We will not tell about them in detail now because this post will become too long. Soon we will write a complete post on Cache Mapping, under which these three techniques will be explained with the help of diagram.

Different Levels in Cache Memory

There are many different levels of cache memory in a computer. These reflect their closeness and accessibility to the cache levels, CPU. That is, the cache which will be located closer to the CPU in the computer will be faster than the rest of the levels. But it will store the least data and will also be more expensive. So let’s know about these different levels of cache memory.

Level 1 or L1 Cache

It is the fastest cache because the L1 cache is embedded in the CPU chip. In most computers, it acts as a CPU cache. That’s why it is also called primary cache. The size of the L1 cache is the least and it can store up to 64kb of cache memory. However, in some powerful CPUs, the size of this cache is up to 1MB.

In terms of priority of usage, L1 holds the type of data that the CPU needs repeatedly to perform a task. This is a cache made from SRAM (Static RAM). Address register is an example of this.

Level 2 or L2 Cache

The L2 cache is slower than the L1 but is larger in size. It usually has a memory between 64kb-8mb. Although it is also present in the CPU, but often it is a separate chip between the CPU and the RAM. Whenever CPU searches for instructions in L1 Cache and it does not find them there, it will search required instructions in L2 Cache. That’s why L2 is also called secondary cache.

There is a high speed system bus to connect the cache to the CPU. Due to which the processing does not slow down even in the event of traffic on the main system bus.

Level 3 or L3 Cache

Compared to L1 and L2, L3 has the largest cache memory but also the slowest of the three. Its size can be up to 4mb-50mb. This is a large form of memory present on the computer motherboard. The main use of L3 cache is to speed up the processing operation. This reduces the time taken for requesting data and receiving the request.

Even though a multicore processor may have separate L1 and L2 caches for each core. But all the cores share the same L3 cache among themselves.

Where is the cache memory located

Cache memory is usually located on the CPU chip of the computer. Now because there are many different levels of cache. For example – L1 cache, L2 cache and L3 cache. Therefore their location can be different from each other in the computer. In most modern processors, the L1 and L2 cache are part of the processor core. We call them SRAM. The L3 Cache is often located either in the processor or on the motherboard outside of it. Thus, based on the location of the cache memory, we define them as internal cache and external cache.

Conclusion

In this article you have learned what is Cache Memory? Under which we told you how the cache memory stores the important instructions and data that the CPU needs again and again. Also, it is the fastest computer memory which helps the CPU to complete the task. We tried our best that this post should be kept in very simple language so that this topic can be understood by every person.

So hopefully, this post what is cache memory? (What is Cache Memory) You have found it informative. If you have any question or suggestion related to the post, then please do tell in the comment below. In the end, if you want, you can also share this post with your classmates on social sites like Facebook, Instagram and WhatsApp.

Leave a Reply

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

%d bloggers like this: