The cache is a temporary storage space used to improve the performance of a computer. There are different types of cache memory on a computer, including those that are grafted to processors or those that are extracted from disk space or RAM.
Overview And Role of the Cache Memory
The cache or buffer is a fast memory space for temporarily storing information or instructions. On a computer, the cache is mostly associated with the processor because it allows him to store his instructions and data, pending processing. This architecture provides a considerable gain in the speed of information processing since the processor accesses data faster. For example, the cache memory has a speed of execution of about 10 times faster than the RAM.
Moreover, a processor can be accompanied by several cache memories for optimal exploitation of its power. However, the cache memories are characterized by a reduced size, of the order of a hundred kilobytes to a few megabytes. This is explained by the technological limitation of the development of the cache but also because of its cost. In addition to processors, the cache is also used by some computer peripherals, to name just Scsi-disks.
The operating principle of the cache memory
The cache memory serves as the temporary storage of information used by the processor. To do this, the cache provides the information requested by the processor if it has it, otherwise, it retrieves the information from the main memory and stores it for previous use. In concrete terms, it is the memory addresses that are stored in the cache memory. When the processor wants to write data to the main memory, it checks whether the memory address is available in the cache memory. If this is the case, the processor may write the data, otherwise, a new entry is created in the cache from a copy of the address from the main memory. Due to its reduced storage capacity, the cache selects the data that will be most likely to be reused by the processor before creating a new entry. To do this, the cache counts the number of uses of an entry by the processor and it keeps only those that are used the most by LFU system or Least Frequently Used. Another technology is to consider the oldest entries, the LRU or Least Recently Used system.
Types of cache
Modern computers use 3 types of cache, including cache memories L1, L2, and L3. The L1 cache or primary cache is the fastest of the previous 3 categories. Indeed, this type of cache is directly located in the processor. In addition, the cache L1 contains both data and instructions for the processor; to handle this difference in content, processors exploit two technologies, including unified cache, or its subdivision into two separate entities, one for data and the other for instructions. The L2 cache or secondary cache is also internal to the processor. Its role is to support the L1 cache by storing information that cannot be stored there. Indeed, cache L2 has a larger size than cache L1, of the order of 8Mo, although it is slower. Finally, the L3 cache is a memory external to the processor and it is found especially on high-end processors or those who equip servers. Generally, the management of this memory is provided by an auxiliary circuit to the processor.
The cache of Internet browsers
Internet browsers also use a system based on that of cache memories. During a session on the Internet, the preferences of the user, as well as the data of the sites he visits, are saved in the cache memory. As a result, the Internet browser will be able to load a web page faster since it will draw some information from a recently visited page from the buffer. The cache memory used on an operating system is racked out of space on hard disks or RAM. The allocated memory size can then be adjusted according to the needs of the user, knowing that the larger the memory size, the more it will be possible to store information from a large number of web pages.