What Is a Page Cache?
A page cache, also called a disk cache, is an area of computer random access memory (RAM) that is used to hold and possibly modify data that are stored on a hard disk or other permanent storage device. An operating system uses a page cache for speed and efficiency, because it is faster to read and write information to RAM than it is to continually access areas of a hard disk. In most cases, the mechanism used for caching areas of a hard disk is automatically controlled by the operating system and does not have to be managed or otherwise handled by users or applications. Depending on the operating system, page caching is sometimes used for all reading and writing from a hard drive, regardless of the amount of information being read or written. Another operating system-specific attribute of the page cache is that, after a given period of time, the cache automatically is flushed of any unused information to maintain a large pool of free memory for other applications.
When a computer program requests information from a traditional hard drive, a relatively time-intensive process can take place to retrieve the information. The hard drive is a random access media, so it must physically move a reader to the location on the disk that corresponds to the location where the data block is located. After this occurs, information is read into the computer, where it can be processed. For reading consecutive blocks of information from the drive, more movement of the physical reader, or head, must be performed. This process can be even more time consuming when writing large files to the disk.
Computer RAM, on the other hand, does not require a physical reader and is located very close to the central processing unit (CPU) of the computer. Reading and writing to RAM is much faster than reading and writing to a hard disk. A page cache is a way to minimize the amount of physical reading and writing that must be done to a hard drive.
The process is performed by reading in a certain amount of information from the hard disk when request. The amount of data that is stored in a page cache in RAM is determined by the cache size, and not necessarily by the amount of information requested. Once the data from the drive are in RAM, they remain in RAM until they are no longer needed, or until a point where any changes to the data in the cache need to be written, or flushed, out to the hard drive to be permanently saved. Flushing the cache can occur when the memory must be freed, after a certain period of time, or even through the execution of a user command, if necessary.
A page cache most often is used to store files that do not change but must be referred to continuously, such as executable files and libraries for applications. To increase the speed and security of executing applications from a page cache, some systems mark the memory used for executables as read-only. Using a cache actually can increase the lifespan of a hard drive by reducing the possibility of disk thrashing from multiple reads and writes in a short period of time.
Discuss this Article
Post your comments