I was considering a way to explain what cache memory is all about without taking a Mathematics class on Logarithm and I have decided to try out the following.
I have 100 friends and I cannot remember their names but I need to get their names at random. I also have 5 more friends who can remember the names of 20 people each. So ideally, if I get the help of these 5 people, I should get the names of these 100 friends at random. These 5 people are ready to help me but for a price!! So I cannot really bring in more people to do the job for me but I can rely on these 5 people for the job to be done. So I have my CACHE MEMORY ready!! Whenever I require a name, I can access my 5 people data base anytime and at random and I will surely get the name I require.
The computer architecture more or less works on this principle. We have a slow device like the hard drive which cannot keep up to the speed required by the processor. So got a primary memory installed in between which we call the RAM(Random Access Memory). The RAM is faster of course but it is still slower than the processor to provide the required data whenever possible. Not only that, let us say that the names of those 100 friends are there in 100 “memory locations” of the RAM. We need to say here that the way we all have a house to stay with an address, in a similar way, the data in the RAM are in specific address locations. Now, there are 5 people in the CPU(Processor) or let us say 5 Kilobyte of a very fast kind of memory which we will now call the cache memory. According to the requirement of the CPU, the cache memory will be able to provide the memory address locations of all those 100 people and that will happen very fast. In other words the cache memory will be able to say in which house each of the 100 people resides.
Now the question is I might require the names of those 100 people in a sequential manner or else at random. In a similar way the processor might need to access data sequentially or at random. So the cache memory needs to act either in a sequential manner or at random. Numerous algorithms are devised accordingly by the scientists for the proper functioning of the cache memory.
Without going into the algorithm of cache memory in details let us understand what is this level 1 cache, level 2 cache all about. The processors are not at all simple as they used to be but instead the number of cores in the processor is increasing thus making the structure of the cache memory more complex. So we need L2 cache which would be interacting with the L1 cache before the interaction of the processor starts. In the same way we need L3 cache.
The question still remains to why shouldn’t we replace all primary memory that is RAM with cache memory? The answer is what I had said earlier. My 5 friends are ready to help me provided I pay them well. Cache memory, unlike RAM is still very costly. It is transistor based and not capacitor based as RAM is. So we have a cost versus performance trade off.
So before buying a mother board or a processor, checkout the amount of cache included. It is just not the processor that has included cache memory in it, even the mother board comes with some cache memory. Check the specifications and take help of a technician if required before buying a processor or a mother board. It is the cache memory that makes the difference in performance except the RAM. Also check the FSB(Front Side Bus) or the data path between the processor and the other devices like the RAM. Narrow communication path(related to FSB) between 2 high speed devices can again prove to be a bottle-neck in performance in spite of a good amount of cache memory but cache memory is one of the most important factors in the performance of the computer when speed is concerned.
No comments:
Post a Comment