Overview

The page cache is a kernel mechanism that keeps recently used file contents in main memory as page-sized units rather than as raw disk blocks. By caching file data at the granularity of virtual memory pages, the operating system can service reads and writes from RAM when possible, reducing disk I/O and improving application responsiveness. In many modern systems the page cache is integrated with the virtual memory subsystem so it can hold both file-backed and anonymous pages; this approach is often called a unified virtual memory design.

How it works

On a file read, the kernel checks the page cache for the requested page. A cache hit returns the page from RAM; a miss causes the kernel to fetch the page from storage and insert it into the cache. Writes can be applied to the cache and deferred to disk later (write-back) or forced to storage immediately (write-through or synchronous writes) according to system call flags. The cache is managed by eviction policies that approximate least-recently-used behavior and by performance techniques such as readahead to prefetch sequential pages.

History and adoption

Originally some systems used separate buffers for block devices and for process memory. As virtual memory matured, many kernels moved to a unified model that avoids duplicate buffering and simplifies memory management. Unix-like kernels, Solaris, and the Windows NT family are examples of systems that use page caching as part of their virtual memory implementations. Details of algorithms and tunables differ between implementations, but the core idea—using RAM to hold file contents in page-sized units—is common.

Uses and operational considerations

The page cache benefits a wide range of workloads by lowering latency for repeated reads and smoothing bursts of writes. Because the cache consumes otherwise unused RAM, it is typically reclaimed automatically under memory pressure and is available to applications when needed. System monitoring tools and documentation often report cached memory separately; consult operating system documentation for platform-specific counters and meanings. Applications that require guaranteed durability must explicitly flush modified data (for example with fsync) because cached writes may not reach stable storage immediately.

Notable distinctions and limits

  • Unified vs separate caches: Unified caches hold both process and file-backed pages, whereas older designs kept block buffers distinct.
  • Dirty pages: Pages modified in RAM but not yet written out are called dirty and are periodically flushed to storage by the kernel.
  • Cache pollution: Large sequential scans can evict useful cached data; kernels often provide heuristics or API options to reduce such pollution.
  • Monitoring and tuning: Interpreting cache-related metrics correctly helps administrators avoid misjudging available memory and I/O performance.