Hello Friends, in this blog post I am going to explain to you the cache memory, which is related to programming. We will cover the use and working procedure of cache memory.
It is very simple to understand the concept of cache memory, you can easily learn this with the help few real-life examples related to the cache memory. if we take a real-life banking example, when we go to bank then we usually get withdrawal and deposit voucher on the desk as they are most frequently used whole day in the bank, so if bank will assign a resource for doing this then it will be a burden on bank in terms of time and money both.
Whereas NEFT voucher is not kept usually at the common desk in the bank as they are rarely used in a whole day.
So in the similar fashion of programming, if the active portion of program and data are placed in fast small memory, the average memory access time can be reduced, thus reducing the total execution time of the program. Such a fast small memory is called cache memory.
it is placed between the CPU and main memory, as shown in fig 1 below. The cache memory access time is less than the access time of the memory. by a factor of 5 to 10. The cache is the fastest component in the memory hierarchy and approaches the speed of CPU components.
The fundamental idea of the organization is that by keeping the most frequently accessed instructions and data in the fast cache memory, the average memory access time will approach the access time of the cache.
Although the cache is only a small fraction of the size of the main memory, a large fraction of memory requests will be found in the fast cache memory because of the locality of reference property of programs.
The basic operation of the cache is as follows. When the CPU needs to access memory, the cache is examined. If the word is found in the cache, it is read from the fast memory. If the word addressed by the CPU is not found in the cache, the main memory is accessed to read the word. A block of words containing the just one accessed is then transferred from the main memory to cache memory.
The block size may vary from one word to 16 words adjacent to the one just accessed. In this way, some data are transferred to cache so that future references to memory find the required words in the fast cache memory.
In the case of any queries, you can write to us at email@example.com we will get back to you ASAP.
Hope! you would have enjoyed this post about the cache memory.
Please feel free to give your important feedbacks in the comment section below.
Have a great time! Sayonara!