To enhance a computer’s performance, its memory has to be manufactured such that it has a very high speed. However, this will be at the expense of significantly increasing the computer price. The solution to this dilemma is to use cache memory. Cache is much faster and more expensive than main memory. However, in addition to the main memory, utilizing a cache memory that is very much smaller in size won’t significantly affect the computer price.
When the CPU needs to access memory, the access mechanism first checks to see whether what is needed is already stored in cache. If not, the main memory block containing what is needed and its surroundings is copied into cache. This way, since related data are grouped together in main memory and since program execution is by default sequential, it is highly probable that in the near future the CPU needs will already be found in cache.
Based upon whether it is located inside the CPU or not, cache is described as being internal or external. Based on which is searched first for contents, internal and external caches are frequently referred to as level 1 (L1) and level 2 (L2) caches, respectively. The word cache means “hidden” in English and since data are automatically transmitted between the main memory and cache, programs do not need to be aware that cache memory exists. |