From TheBestLinks.com
(Redirected from
Caching)
- This article is about the computer term. For towns with this name, see Cache, Utah or Cache, Oklahoma.
In the most general sense, a cache is a place, often hidden, for holding valuable items. This term may be used, for example, in the context of hidden treasures, stored food for later consumption by animals, or a cache of arms (a weapons cache) placed by an army during war for later use. This article describes, however, a more specific technical meaning that has become common in relation to computers and their manipulation of data.
Computer caches
In computer science, a cache is a collection of duplicate data, where the original data is expensive to fetch or compute (usually in terms of access time) relative to the cache. Future accesses to the data can be made by accessing the cached copy rather than refetching or recomputing the original data, so that the perceived average access time is lower.
The reason caches work at all is that many access patterns in typical computer applications have locality of reference. There are several sorts of locality, but we mainly mean that often the same data is accessed frequently or with accesses that are close together in time, or that data near to each other are accessed close together in time.
CPU caches
Main article: CPU cache
Small memories on or close to the CPU chip can be made
faster than the much larger main memory. Most CPUs
since the 1980s have used one or more caches, and modern
general-purpose CPUs inside personal computers may have
a dozen, each specialized to a different part of the
problem of executing programs.
Disk caches
Hard disks have historically often been packaged with embedded computers used for
control and interface protocols. Since the late 1980s, nearly all disks sold have
these embedded computers and either an ATA, SCSI, or Fibre Channel
interface. The embedded computer usually has some small amount of memory which
it uses to cache the bits going to and coming from the disk platter.
The disk cache is physically distinct from and is used differently than the
page cache typically kept by the operating system in the computer's main memory. The disk cache is controlled by the embedded computer in the disk
drive, where the page cache is controlled by the computer to which that disk
is attached. The disk cache is usually quite small, 2 to 8 MB, where the page
cache is generally all unused physical memory, which in a 2004 PC may be between
20 and 2000 MB. And while data in the page cache is reused multiple times, the
data in the disk cache is typically never reused. In this sense, the phrase
disk cache is a misnomer, and it might more appropriately be called the disk
buffer. But that is not the phrase typically used.
The disk cache has multiple uses:
- Readahead / readbehind: When executing a read from the disk, the disk arm will move the read/write head to (or near) the correct track, and after some settling time the read head will begin to pick up bits. Usually, the first sectors to be read are not the ones that have been requested by the operating system. The disk's embedded computer will typically save these unrequested sectors in the disk cache, in case the operating system requests them later.
- Speed matching: the speed of the disk's I/O interface to the computer almost never matches the speed at which the bits are transferred to and from the platter. The disk cache is used as a buffer so that both the I/O interface and the disk read/write head can operate at full speed.
- Write acceleration: The disk's embedded computer may signal the main computer that a disk write is complete immediately after receiving the write data, before the data is actually written to the platter. This early signal allows the main computer to continue working, but is somewhat dangerous because, if power is lost before the data is finally written to the disk, the filesystem may be left in an inconsistent state. Write acceleration is quite controversial, and for this reason can usually be turned off. On some disks, the write can be deferred indefinitely by newly arriving requests. Write acceleration is generally never used on database servers or other machines where the integrity of the data on the disks is very important.
Other caches
The CPU caches are generally managed entirely by hardware. Other caches are managed by a variety of software. The cache of disk sectors in main memory is usually managed by the operating system kernel or file system. The BIND DNS daemon caches a mapping of domain names to IP addresses, as does a resolver library.
Caching for reading access only is common when operating over networks, because the coherency protocol may become
exceedingly complicated if communication is not reliable. For instance, web page caches and client-side network file system caches (like those in NFS or CIFS) are typically read-only specifically to keep the network protocol simple and reliable.
A cache of recently visited web pages can be managed by your Web browser. Some browsers are configured to use an external proxy web cache, a server program through which all web requests are routed so that it can cache frequently accessed pages for everyone in an organization. Many ISPs use proxy caches to save bandwidth on frequently-accessed web pages.
The search engine Google keeps a cached copy of each page it examines on the web. These copies are used by the Google indexing software, but they are also made available to Google users, in case the original page is unavailable. If you click on the "Cached" link in a Google search result, you will see the web page as it looked when Google indexed it.
See also
External links
de:Cache
es:caché
fi:Välimuisti
fr:Mémoire cache
hr:Cache
hu:Gyorsítótár
it:cache
ja:キャッシュ (コンピュータシステム)
nl:cache
pl:cache
Related links
Top visited
0 of
0 links
[no links posted yet]
>> place link >>
Discussion
Last posted
0 of
0 messages
[no messages posted yet]
>> post message >>
Watch
You can
add this article to your own "watchlist" and receive e-mail notification about all changes in this page.