Nepedia
Back to Discover
Fluent Reader
💻

Cache (computing)

technology Maturity 7-9 Next article →

A computer cache is a special tool used to make systems work faster. It can be part of the hardware or part of the software. The main job of a cache is to store copies of data. This allows the computer to serve future requests for that data much more quickly.

cache,basic
cache,basic

Caches are usually small because size creates a trade-off with speed. In memory design, larger capacity means signals must travel longer physical distances. This causes delays called propagation delays. Because of this, caches must stay relatively small to remain effective.

When a computer needs to find data, it follows a specific way of working. First, the client, like a CPU or a web browser, checks the cache. Each entry in the cache has a tag to identify the data. If the tag matches what is needed, it is called a cache hit. This is very fast because the data is read right from the cache. If the tag does not match, it is called a cache miss.

Write-through with no-write-allocation
Write-through with no-write-allocation

In a miss, the computer must fetch data from a slower backing store. Once found, the data is usually copied into the cache for next time.

To keep the cache from getting too full, the system uses a replacement policy. This is a rule for which old data to remove to make room for new data. One popular method is called least recently used, or LRU. This policy removes the entry that was accessed the longest time ago.

Write-back with write-allocation
Write-back with write-allocation

Other smart algorithms look at how often data is used. Some systems even use prefetching to guess what data will be needed soon. They grab these chunks ahead of time to avoid waiting for a miss.

There are also different ways to handle writing new information. A write-through cache performs writes to both the cache and the backing store at the same time. This is a synchronous process. A write-back cache is more complex but can be faster. It only writes to the cache at first and waits to update the backing store later. This is often called a lazy write. This happens when the modified content is about to be replaced by something else. These different rules help balance speed and how data is saved.

Caches are found in many places in our modern world. Most CPUs have used one or more caches since the 1980s. Some high-end processors even have as many as six different types of cache. You can find them in solid-state drives and even in web browsers. Even graphics units, or GPUs, use caches to handle data for images. These small, fast memories help everything from your phone to the internet run smoothly.

449 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (3)
File:cache,basic.svg
cache,basic.svg
File:Write-through with no-write-allocation.svg
Write-through with no-write-allocation.svg
File:Write-back with write-allocation.svg
Write-back with write-allocation.svg
More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.