The cache memory is kept between the CPU and the main memory. It is much faster than main memory. Therefore, its access time is much less than the main memory. The cache memory has an access time of 15-25 nanoseconds (ns), while the main memory has 80 nanoseconds, the cache memory stores the data and instructions that are to be executed immediately. It is typically used to reduce the average access time for data, addresses, or instructions stored in main memory. Cache memory increases the operating speed of the main memory system. Cache memory is much more expensive than main memory. On the basis of economic aspects, the size of cache memory is also smaller than the main memory. Sometimes the cache is used only to store instructions. A similar cache is used in 68020 processors. It contains a cache containing 256 bytes of instructions, which allows the instructions to be retrieved from the main memory and store them in the cache. This happens when the system bus is empty. The 68030 microprocessor has both a 256-byte instruction cache and a 256-bit data cache.
The high-speed memory used for cache work is costly, so it is not used for the main memory of the computer, the cache controller often keeps the information in the cache memory that the processor often needs. This cache controller always ensures that the data cache requested by the processor in the next memory access is available in the memory. This increases the speed of the computer to a great extent because of the required data is in the cache memory; it is sent to the CPU immediately without waiting. When the required data is available in the cache, it is called Hit. In the case of a Cache Hit, the processor immediately reads or writes data from the data cache line. The part of the access that results in a cache hit is called the hit rate and is a measure of the cache’s effectiveness.
When the required data cache is not available in memory, it is called miss. In the case of a cache miss, most of the cache locates the new entry, which contains a just missed tag and a copy of the data brought from memory. This reference is then applied to the new entry as in the case of a hit. Misses are comparatively slow because they need to transfer data from main memory. This transfer causes delays because the main memory cache is much slower than the memory.
The function of the cache depends on the following:
- Speed and size of cache memory.
- Logic used to read data around the memory area read by the CPU.
- Logic used to predict the next data required by the processor.
Most new microprocessors have cache memory which is added to the CPU chip itself to make the process faster.
Even in these CPUs, which have a built-in internal cache, you can add external cache memory.