Log in Sign up
Back to Discover
💻

Cache (computing)

technology Maturity 7-9

Computers use a special helper.

cache,basic.svg
cache,basic.svg
It keeps things close by. This helps the computer work fast. It finds what it needs quickly. This makes your games run well. Do you like fast computers?

34 words

Computers use a special helper to work fast.

cache,basic.svg
cache,basic.svg
This helper is called a cache. It keeps a copy of things you use. It stores them close to the brain of the computer.

When the computer needs something, it looks in the cache first. If it finds it, that is a hit. This is very fast!

If it is not there, it is a miss. The computer must look in a slower place. Then, it copies the thing into the cache.

Sometimes, the cache gets too full. The computer must move an old thing out. This makes room for the new thing.

This helps your computer run smoothly every day.

110 words

A computer uses a special tool to work faster. We call this a cache.

cache,basic.svg
cache,basic.svg
A cache is a small part of hardware or software. It stores copies of data. This helps the computer find things quickly later.

When a computer needs data, it checks the cache first. If it finds the data, this is a cache hit. A hit is very fast. If it cannot find the data, it is a cache miss. A miss means the computer must look in a slower place. This takes more time. After a miss, the computer often copies the data into the cache.

Write-through with no-write-allocation.svg
Write-through with no-write-allocation.svg
Caches are small because big ones are slow. Large parts take more time for signals to travel. To make room, the cache must sometimes remove old data. One way to do this is the least recently used policy. This rule removes the data that has not been used for the longest time.

Write-back with write-allocation.svg
Write-back with write-allocation.svg
There are also different ways to write new data. In a write-through cache, data is saved to both the cache and the main store at once. In a write-back cache, the computer waits to save the data until later. This can make the system even faster.

205 words

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.svg
cache,basic.svg
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.svg
Write-through with no-write-allocation.svg
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.svg
Write-back with write-allocation.svg
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.

451 words

In computing, a cache is a hardware or software component designed for speed. It stores data so that future requests for that information can be served much faster. A cache might hold the result of an earlier computation or a copy of data stored elsewhere.

cache,basic.svg
cache,basic.svg
Because caches are meant to be extremely fast, they must remain relatively small. This is due to an inherent trade-off in memory design. Larger capacities require larger physical sizes. This creates greater distances for electronic signals to travel. These distances cause propagation delays that slow down the system.

The mechanism of a cache relies on a pool of entries. Each entry contains specific data and an associated tag. The tag identifies which piece of data from a slower backing store is being copied. When a client, such as a CPU or web browser, needs data, it first checks the cache. If the tag matches the requested data, a cache hit occurs. The system reads the data directly from the cache, which is very fast. If the tag does not match, a cache miss occurs. The system must then perform a more expensive access to the slower backing store.

Write-through with no-write-allocation.svg
Write-through with no-write-allocation.svg
Once retrieved, the new data is typically copied into the cache. To make room, the system uses a replacement policy to remove an existing entry. One common policy is least recently used (LRU), which removes the entry accessed longest ago.

Caches manage data using different write policies to handle updates. A write-through cache performs writes synchronously to both the cache and the backing store. In contrast, a write-back cache initially writes only to the cache. This method postpones the update to the backing store until the modified content is about to be replaced. This delayed process is known as a lazy write. Because write-back caches are more complex, they must track which locations have been modified. These modified locations are marked as "dirty" to ensure they are eventually updated.

Write-back with write-allocation.svg
Write-back with write-allocation.svg
When a write miss occurs, systems also use write-miss policies. A write-allocate policy loads the data into the cache after a miss. A no-write-allocate policy writes the data directly to the backing store without loading it into the cache.

Efficiency in caching is driven by the principle of locality of reference. This concept describes how computer applications typically access data in predictable patterns. Temporal locality occurs when data that was recently requested is likely to be requested again soon. Spatial locality occurs when data stored near recently requested data is likely to be needed next. To take advantage of this, many systems use prefetching. Prefetching involves guessing where future reads will come from and requesting that data ahead of time. If done optimally, this allows the system to bypass latency altogether.

Different types of hardware utilize specialized caching structures. Central processing units (CPUs) have used caches since the 1980s. Modern high-end processors may use as many as six different types of cache. These include the instruction cache (I-cache) and the data cache (D-cache). Another specialized cache is the translation lookaside buffer (TLB). The TLB is used by the memory management unit (MMU) to record virtual-to-physical address translations. Graphics processing units (GPUs) also use caches to handle texture data and shader instructions. Digital signal processors (DSPs) have evolved to include similar cache structures to CPUs.

Caching also plays a vital role in network architecture. In information-centric networking (ICN), the network itself acts as a loosely connected network of caches. This is different from a standard proxy server because it is a network-level solution. ICN requires very fast and lightweight eviction policies because cache states change rapidly. Some network caches use a variant called time-aware least recently used (TLRU). This algorithm uses a "time to use" (TTU) timestamp. The TTU allows administrators to regulate storage based on the usability time of the content.

Understanding caches helps explain the balance between latency and throughput. Latency is the delay before a transfer begins, while throughput is the amount of data moved. A large resource, like DRAM, can incur significant latency. For a modern 4 GHz processor, reaching DRAM can take hundreds of clock cycles. Caches mitigate this by reading large chunks of data at once. This can also increase throughput by assembling small transfers into larger, more efficient requests. This connection between small, fast memory and large, slow storage is fundamental to modern computing.

729 words
🖼️ 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
Up Next
💻
Cache replacement policies
Technology
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.