Cache definition : The Cache Memory (Pronounced as "cash") is the volatile computer memory which is very nearest to the CPU so also called CPU memory, all the Recent Instructions are Stored into the Cache Memory. It is the fastest memory that provides high-speed data access to a computer microprocessor. Cache meaning is that it is used for storing the input which is given by the user and which is necessary for the computer microprocessor to Perform a Task. But the Capacity of the Cache Memory is too low in compare to Memory (random access memory (RAM)) and Hard Disk.
Importance of Cache memory
The cache memory lies in the path between the processor and the memory. The cache memory therefore, has lesser access time than memory and is faster than the main memory. A cache memory have an access time of 100ns, while the main memory may have an access time of 700ns.
The cache memory is very expensive and hence is limited in capacity. Earlier cache memories were available separately but the microprocessors contain the cache memory on the chip itself.
The need for the cache memory is due to the mismatch between the speeds of the main memory and the CPU. The CPU clock is very fast, whereas the main memory access time is comparatively slower. Hence, no matter how fast the processor is, the processing speed depends more on the speed of the main memory (the strength of a chain is the strength of its weakest link). It is because of this reason that a cache memory having access time closer to the processor speed is introduced.
The cache memory stores the program (or its part) currently being executed or which may be executed within a short period of time. The cache memory also stores temporary data that the CPU may frequently require for manipulation.
The cache memory works according to various algorithms, which decide what information it has to store. These algorithms work out the probability to decide which data would be most frequently needed. This probability is worked out on the basis of past observations.
It acts as a high speed buffer between CPU and main memory and is used to temporary store very active data and action during processing since the cache memory is faster then main memory, the processing speed is increased by making the data and instructions needed in current processing available in cache. The cache memory is very expensive and hence is limited in capacity.
Type of Cache memory
Cache memory improves the speed of the CPU, but it is expensive.Type of Cache Memory is divided into different level that are L1,L2,L3:
Level 1 (L1) cache or Primary Cache
L1 is the primary type cache memory. The Size of the L1 cache very small comparison to others that is between 2KB to 64KB, it depent on computer processor. It is a embedded register in the computer microprocessor(CPU).The Instructions that are required by the CPU that are firstly searched in L1 Cache. Example of registers are accumulator, address register,, Program counter etc.
Level 2 (L2) cache or Secondary Cache
L2 is seconday type cache memory. The Size of the L2 cache is more capacious than L1 that is between 256KB to 512KB.L2 cache is Located on computer microprocessor.After searching the Instructions in L1 Cache,if not found then it searched into L2 cache by computer microprocessor. The high-speed system bus interconnecting the cache to the microprocessor.
Level 3 (L3) cache or Main Memory
The L3 cache is larger in size but also slower in speed than L1 and L2,it's size is between 1MB to 8MB.In Multicore processors, each core may have seperate L1 and L2,but all core share a common L3 cache. L3 cache double speed than the RAM.