In computer science, a cache (pronounced /kæʃ/, like "cash" [1]) is a collection of data duplicating original values stored elsewhere or computed earlier, where the original data is expensive to fetch (owing to longer access time) or to compute, compared to the cost of reading the cache. Computer science (or computing science) is the study and the Science of the theoretical foundations of Information and Computation and their Access time is the time delay or latency between a request to an electronic system and the access being completed or the requested data returned In other words, a cache is a temporary storage area where frequently accessed data can be stored for rapid access. Once the data is stored in the cache, future use can be made by accessing the cached copy rather than re-fetching or recomputing the original data, so that the average access time is shorter. Cache, therefore, helps expedite data access that the CPU would otherwise need to fetch from main memory.
Cache has proven to be extremely effective in many areas of computing because access patterns in typical computer applications have locality of reference. Application software is a subclass of Computer software that employs the capabilities of a computer directly and thoroughly to a task that the user wishes to perform In Computer science, locality of reference, also known as the principle of locality, is the phenomenon of the same value or related storage locations There are several kinds of locality, but this article primarily deals with data that are accessed close together in time (temporal locality). In Computer science, locality of reference, also known as the principle of locality, is the phenomenon of the same value or related storage locations The data might or might not be located physically close to each other (spatial locality). In Computer science, locality of reference, also known as the principle of locality, is the phenomenon of the same value or related storage locations
Contents |
Use of the word “cache” in the computer context originated in 1967 during preparation of an article for publication in the IBM Systems Journal. The paper concerned an exciting memory improvement in Model 85, a latecomer in the IBM System/360 product line. The Journal editor, Lyle R. Johnson, pleaded for a more descriptive term than “high-speed buffer”; when none was forthcoming, he suggested “Cache. ” (from the French “cacher”, meaning to hide). The paper was published in early 1968, the authors were honored by IBM, their work was widely welcomed and subsequently improved upon, and “Cache” soon became standard usage in computer literature. [2]
A cache is a block of memory for temporary storage of data likely to be used again. The CPU and hard drive frequently use a cache, as do web browsers and web servers. A hard disk drive ( HDD) commonly referred to as a hard drive, hard disk, or fixed disk drive, is a Non-volatile storage device
A cache is made up of a pool of entries. Each entry has a datum (a nugget of data) which is a copy of the datum in some backing store. Each entry also has a tag, which specifies the identity of the datum in the backing store of which the entry is a copy.
When the cache client (a CPU, web browser, operating system) wishes to access a datum presumably in the backing store, it first checks the cache. If an entry can be found with a tag matching that of the desired datum, the datum in the entry is used instead. This situation is known as a cache hit. So, for example, a web browser program might check its local cache on disk to see if it has a local copy of the contents of a web page at a particular URL. In this example, the URL is the tag, and the contents of the web page is the datum. The percentage of accesses that result in cache hits is known as the hit rate or hit ratio of the cache.
The alternative situation, when the cache is consulted and found not to contain a datum with the desired tag, is known as a cache miss. The previously uncached datum fetched from the backing store during miss handling is usually copied into the cache, ready for the next access.
During a cache miss, the CPU usually ejects some other entry in order to make room for the previously uncached datum. The heuristic used to select the entry to eject is known as the replacement policy. In Computer science, a heuristic algorithm or simply a Heuristic is an Algorithm that ignores whether the solution to the problem can be proven In a Computer Operating system that utilizes Paging for Virtual memory Memory management, page replacement algorithms decide which One popular replacement policy, least recently used (LRU), replaces the least recently used entry (see cache algorithms). For detailed algorithms specific to the cache between a CPU and RAM see CPU cache. More efficient caches compute use frequency against the size of the stored contents, as well as the latencies and throughputs for both the cache and the backing store. While this works well for larger amounts of data, long latencies, and slow throughputs, such as experienced with a hard drive and the Internet, it's not efficient to use this for cached main memory (RAM). Computer data storage, often called storage or memory, refers to Computer components devices and recording media that retain digital
When a datum is written to the cache, it must at some point be written to the backing store as well. The timing of this write is controlled by what is known as the write policy.
In a write-through cache, every write to the cache causes a synchronous write to the backing store.
Alternatively, in a write-back (or write-behind) cache, writes are not immediately mirrored to the store. Instead, the cache tracks which of its locations have been written over (these locations are marked dirty). The data in these locations is written back to the backing store when those data are evicted from the cache. For this reason, a miss in a write-back cache (which requires a block to be replaced by another) will often require two memory accesses to service: one to retrieve the needed datum, and one to write replaced data from the cache to the store.
Data write-back may be triggered by other policies as well. The client may make many changes to a datum in the cache, and then explicitly notify the cache to write back the datum.
No-write allocation is a cache policy where only processor reads are cached, thus avoiding the need for write-back or write-through when the old value of the datum was absent from the cache prior to the write.
The data in the backing store may be changed by entities other than the cache, in which case the copy in the cache may become out-of-date or stale. Alternatively, when the client updates the data in the cache, copies of that data in other caches will become stale. Communication protocols between the cache managers which keep the data consistent are known as coherency protocols. In computing Cache coherency (also cache coherence) refers to the integrity of data stored in local caches of a shared resource
Small memories on or close to the CPU chip can be made faster than the much larger main memory. A microprocessor incorporates most or all of the functions of a Central processing unit (CPU on a single Integrated Most CPUs since the 1980s have used one or more caches, and modern general-purpose CPUs inside personal computers may have as many as half a dozen, each specialized to a different part of the problem of executing programs. A personal computer ( PC) is any Computer whose original sales price size and capabilities make it useful for individuals and which is intended to be operated
CPU caches are generally managed entirely by hardware; other caches are managed by a variety of software. In Computer Operating systems that have their Main memory divided into pages, paging (sometimes called swapping) is a transfer The page cache in main memory, which is an example of disk cache, is usually managed by the operating system kernel. In computing page cache, sometimes ambiguously called disk Cache, is a "transparent" buffer of disk-backed pages kept in Main memory (RAM by Computer data storage, often called storage or memory, refers to Computer components devices and recording media that retain digital In Computer science, the kernel is the central component of most computer Operating systems (OS
While the hard drive's hardware disk buffer is sometimes misleadingly referred to as "disk cache", its main functions are write sequencing and read prefetching. In Computer storage, disk buffer (often ambiguously called disk cache or cache buffer) is the embedded memory in a Hard drive acting as Repeated cache hits are relatively rare, due to the small size of the buffer in comparison to HDD's capacity.
In turn, fast local hard disk can be used to cache information held on even slower data storage devices, such as remote servers (web cache) or local tape drives or optical jukeboxes. Web caching is the caching of Web documents (eg HTML pages, images) in order to reduce bandwidth usage server load A tape drive, which is also known as a streamer, is a data storage device that reads and writes data stored on a magnetic tape. An optical jukebox is a robotic Data storage device that can automatically load and unload Optical discs such as Compact Disc, DVD, Ultra Such a scheme is the main concept of hierarchical storage management. Hierarchical Storage Management ( HSM) is a data storage technique which automatically moves data between high-cost and low-cost storage media
The BIND DNS daemon caches a mapping of domain names to IP addresses, as does a resolver library. The Domain Name System (DNS is a hierarchical naming system for computers services or any resource participating in the Internet. An Internet Protocol ( IP) address is a numerical identification ( Logical address) that is assigned to devices participating in a Computer network
Write-through operation is common when operating over unreliable networks (like an Ethernet LAN), because of the enormous complexity of the coherency protocol required between multiple write-back caches when communication is unreliable. In computing Cache coherency (also cache coherence) refers to the integrity of data stored in local caches of a shared resource For instance, web page caches and client-side network file system caches (like those in NFS or SMB) are typically read-only or write-through specifically to keep the network protocol simple and reliable. In Computer networking the term client-side refers to operations that are performed by the client in a Client-server relationship A network file system is any computer File system that supports sharing of files, printers and other resources as Persistent storage over Network File System (NFS is a Network file system protocol originally developed by Sun Microsystems in 1983 allowing a user on a client Computer to access In Computer networking, Server Message Block ( SMB) operates as an application-level network protocol mainly used to provide Shared access
A cache of recently visited web pages can be managed by your web browser. A web browser is a software application which enables a user to display and interact with text images videos music games and other information typically located on a 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. In Computer networks a proxy server is a server (a computer system or an application program which services the requests of its clients by forwarding Web caching is the caching of Web documents (eg HTML pages, images) in order to reduce bandwidth usage server load Many internet service providers use proxy caches to save bandwidth on frequently-accessed web pages. An Internet service provider ( ISP, also called Internet access provider or IAP) is a company which primarily offers their customers access to the Internet In Computer networking and Computer science, digital bandwidth or just bandwidth is the capacity for a given system to transfer data over a connection
Search engines also frequently make web pages they have indexed available from their cache. A web page or webpage is a resource of information that is suitable for the World Wide Web and can be accessed through a Web browser. For example, Google provides a "Cached" link next to each search result. Google Inc is an American public corporation, earning revenue from advertising related to its Internet search, e-mail, online This is useful when web pages are temporarily inaccessible from a web server. The term web server can mean one of two things A Computer program that is responsible for accepting HTTP requests from web clients which are
Another type of caching is storing computed results that will likely be needed again, or memoization. In Computing, memoization is an optimization technique used primarily to speed up Computer programs by having function calls avoid repeating An example of this type of caching is ccache, a program that caches the output of the compilation to speed up the second-time compilation. In Software development, ccache is a tool which caches the output of C / C++ compilation so that the next time the same compilation can be
Database caching can substantially improve the throughput of database applications, for example in the processing of indexes, data dictionaries, and frequently used subsets of data. Many applications today are being developed and deployed on multi-tier environments that involve browser-based clients web application servers and backend databases A Computer Database is a structured collection of records or data that is stored in a computer system A database index is a Data structure that improves the speed of operations on a database table. A data dictionary, as defined in the IBM Dictionary of Computing is a "centralized repository of information about data such as meaning relationships to other data origin TimesTen provides a mid-tier caching facility that can be integrated into Oracle databases. TimesTen is a Database product from Oracle Corporation. It provides a family of real-time infrastructure Software products designed for Oracle Database (commonly referred to as Oracle RDBMS or simply Oracle) is a Relational database management system (RDBMS produced and marketed by
The terms are not mutually exclusive and the functions are frequently combined; however, there is a difference in intent. A buffer is a temporary memory location, that is traditionally used because CPU instructions cannot directly address data stored in peripheral devices. In Computing, a buffer is a region of memory used to temporarily hold Data while it is being moved from one place to another In Computer science, an instruction is a single operation of a processor defined by an Instruction set architecture. Thus, addressable memory is used as intermediate stage. Additionally such buffer may be feasible when a large block of data is assembled or disassembled (as required by a storage device), or when data must be delivered in a different order than that in which it is produced. Also a whole buffer of data is usually transferred sequentially (for example to hard disk), so buffering itself sometimes increases transfer performance. These benefits are present even if the buffered data are written to the buffer once and read from the buffer once.
A cache also increases transfer performance. A part of the increase similarly comes from the possibility that multiple small transfers will combine into one large block. But the main performance gain occurs because there is a good chance that the same datum will be read from cache multiple times, or that written data will soon be read. Cache's sole purpose is to reduce accesses to the underlying slower storage. Cache is also usually an abstraction layer that is designed to be invisible from the perspective of neighboring layers. This is about the concept in computer science for the concept in grouping see Principle of abstraction.