What is cache memory?

Cache memory is a small-sized volatile computer memory that provides high-speed data access to a processor and stores frequently used computer programs, applications and data. Cache memory also called CPU memory, which is placed between random access memory (RAM) and a computer microprocessor. It can be accessedquicker by microprocessor than regular RAM.
It is designed to speed up the transfer of data and instructions. The data and instructions are retrieved from RAM when CPU uses them for the first time. A copy of that data or instructions is stored in cache. The next time the CPU needs that data or instructions, it first looks in cache. If the required data is found there, it is retrieved from cache memory instead of main memory. It speeds up the working of CPU.
A computer can have several different levels of cache memory. The level numbers refers to distance from CPU where Level 1 is the closest. All levels of cache memory are faster than RAM. The cache closest to CPU is always faster but generally costs more and stores less data then other level of cache.
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.
In addition to hardware-based cache, cache memory also can be a disk cache, where a reserved portion on a disk stores and provides access to frequently accessed data from the disk.