Cache memory is a fast storage area used to store frequently used data and instructions. It uses a small amount of physical RAM for storage.
A cache used by the CPU to reduce the average time to access memory. As long as most memory accesses are to cached memory locations, the average time taken for memory accesses will be less than time taken to access main memory.
The processor has an internal cache controller that integrates the cache with the CPU. This cache controller stores frequently accessed RAM locations to provide faster execution of data and instruction. Such a cache is known as a level 1 Cache. There is a similar cache external to the CPU, called a level 2 Cache. The level 2 Cache performs the same functions as level 1 Cache and can speed up the performance. Basically, a larger cache leads to a faster CPU.
When the processor has to read or write a location in main memory, it first checks whether that memory location is in the cache. This is done by comparing the address of the memory location to all tags in the cache that might contain that address. If the processor finds that the memory location is in the cache, it is a cache hit, otherwise it is a cache miss. In the case of a cache hit, the processor immediately reads or writes the data in the cache line. The proportion of accesses that result in a cache hit is known as the hit rate, and is a measure of the effectiveness of the cache.










