Home / Definitions / Cache

Cache

Vangie Beal
Last Updated May 28, 2021 9:28 am

Pronounced cash, a special high-speed storage mechanism. Cache can be either a reserved section of main memory or an independent high-speed storage device. Two types of caching are commonly used in personal computers: memory caching and disk caching.

Memory Caching

A memory cache, sometimes called a cache store or RAM cache, is a portion of memory made of high-speed static RAM (SRAM) instead of the slower and cheaper dynamic RAM (DRAM) used for main memory. Memory caching is effective because most programs access the same data or instructions over and over. By keeping as much of this information as possible in SRAM, the computer avoids accessing the slower DRAM.

cache

L1 and L2 Caches

Some memory caches are built into the architecture of microprocessors. The Intel G6500T processor, for example, contains an 4MB memory cache. Such internal caches are often called Level 1 (L1) caches. Most modern PCs also come with external cache memory, called Level 2 (L2) caches. These caches sit between the CPU and the DRAM. Like L1 caches, L2 caches are composed of SRAM but they are much larger.

As systems become more complex, higher-end systems and CPUs can include additional layers of caching, such as L3 and higher.

Disk Caching

Disk caching works under the same principle as memory caching, but instead of using high-speed SRAM, a disk cache uses conventional main memory. The most recently accessed data from the disk (as well as adjacent sectors) is stored in a memory buffer. When a program needs to access data from the disk, it first checks the disk cache to see if the data is there. Disk caching can dramatically improve the performance of applications, because accessing a byte of data in RAM can be thousands of times faster than accessing a byte on a hard disk, but solid state drives (SSD) have improved the performance gap somewhat.

Smart Caching

When data is found in the cache, it is called a cache hit, and the effectiveness of a cache is judged by its hit rate. Many cache systems use a technique known as smart caching, in which the system can recognize certain types of frequently used data. The strategies for determining which information should be kept in the cache constitute some of the more interesting problems in computer science.

Caching Issues and Problems

In general, caches create problems when there is a discrepancy between the cache and the main memory. This can happen if the main memory has been updated and the cache has not, so the cache will not reflect any recent changes. Cache coherence thus becomes a challenge in more complex systems, and a computer crash can lead to lost data that hasn’t been written to main memory – in addition to the risk of losing stored data if a drive can’t be recovered.

Cache in Web Browsing

Caches also play an important role in the web browsing and web development experience, sometimes referred to as web cache, http cache or proxy cache. Similar to the caches at the processor level, web browsers can store frequently accessed data like web pages or images on the hard drive, and web servers also must clear cache so the most recent version of a website can be displayed to users. Deleting browser cache can speed performance while ensuring the user gets the most recent version of a webpage.