There are three different kind of caching on a system: The cache memory is built on a computer Processing Unit (CPU) and disk cache is for the hard drive and the browser cache is on several web browsers.
The word ‘Cache’ means to store and the Cache Memory is nothing but a storage area in a block of RAM (Random Access Memory) of your computer. It is used for a faster access to frequently used data/programs. The memory cache is derived from high-speed Static RAM (SRAM) than Dynamic RAM (DRAM) used to access main memory of the computer. Caching is very similar to the way you manage your phone numbers like where you have your favorite sections (Cache) and your main contact numbers (RAM). The very advantage of cache memory is it avoids the data transfer done through motherboard’s system bus which thus increases the speed of data access. The CPU caches are more in numbers for a rapid process of data access and its retrieval. Cache in CPU unit is referred as Level1 cache (L1 cache) and cache stored in a chip next to CPU is termed as Level2 cache (L2 cache) and it resides on the motherboard. Some systems also carry a separate chip and designate it as L3 cache.
The effectiveness of a cache memory
The effectiveness of a cache memory to work is determined by the locality of reference and cache block. Locality of reference is a particular location storage which is referenced frequently (Divided among L1, L2 and L3 cache) for the data access.
The locality of reference is based on two forms, namely:
- Temporal locality
- Spatial locality
Temporal Locality refers to access of that program which is accessed once, would likely to be accessed again. This allocates a reference point of the data accessed in the memory.
Spatial locality refers to any data that is in close proximity to the recently accessed data, would be referenced i.e allocation of neighbours in the memory points as there is faster access.
A set of close addresses are put in cache block for easy access. A pre-determined allocation through locality of reference in computer helps in eradication of memory problems and thus cache memory gets well managed.
If there is accessibility to the required data through cache, then it is a cache hit and any non-availability through cache is considered cache miss.
The inbuilt caches of the CPU are much faster than the separate cache units however the separate cache is twice faster than it’s RAM. The inbuilt cache is quite expensive than RAM but nevertheless, in order to maximize your system’s performance, it is worth to invest on CPU and motherboard with inbuilt caches than to go for a RAM up-gradation.
How the cache memory works?
Computer in itself cannot work; it needs a program which would instruct its CPU to carry out its operations. The CPU in turn relies on the RAM to process any program. The disadvantage with the RAM is there is a data loss due to any power failure in the system. This unpredictable situation demanded a stable memory which would retrieve and store the data even when there is an abrupt turn off to the PC. Whenever any program, stored in the hard disk, is opened/clicked,
the process gets stored to the RAM memory; the CPU executes the program from the RAM through a memory controller circuit which is found on the INTEL processors chipset or in the CPU of AMD processors. The processor, along with the operating system and chipset, calculates on the data and instructions that it wants to access in the coming future. The data and the instructions are set in the cached memory for a quick access/retrieval for the processor.
The operating system works on the constant update of the cache memory with more current data and instruction from its main memory. The process of moving the information from main memory to system’s cache memory is called “cacheable memory”. In general, most of the system’s main memory cacheable limit is 64MB or more. Any information that is non-cacheable passes the information directly to the processor without using the system cache.
The best example for the cache memory would be ‘Word document’. Whenever there is power failure, the unsaved data gets stored on the cached memory, at the time of the power restore, the user gets option of viewing the different versions to the data, including the unsaved data for retrieval.
Caches in Microprocessors
The Intel 80486 microprocessor has an 8K memory cache, and the Pentium 4 has three levels of cache; L1 has cache block of 64k bytes, L2 has 256k bytes of memory cache and L3 is set on a processor chip.