Operating systems keep recently used file data in memory, in the page cache, so that rereading it does not have to wait for the disk. the cache is shared among all programs and sized to the machine's memory demand. But every read, even of data already in memory, must enter the kernel through a system call. For programs that read cached files at a high rate, such as web servers and databases, this fixed cost on every read adds up. A program can avoid it by keeping a private cache of its own, but then loses the sharing and the elastic memory management of the page cache.
We present CacheOut, a page cache layer that runs in user space, alongside unmodified programs rather than in the kernel. It keeps no copy of the data. Instead, it reads directly from the kernel’s page cache, which therefore stays shared and kernel managed, while serving each cached read as an ordinary memory copy, with no system call.
The layer also lets a program supply its own cache policies, written as ordinary user-space code, and runs them at a lower cost than existing approaches that run them inside the kernel.
We show how CacheOut preserves read semantics when files change, keeps kernel prefetching aware of read sizes, and applies program eviction policies under memory pressure, all without reintroducing per-read kernel calls.
On web servers, a database, a file server and a key-value store, CacheOut raises throughput by up to 19% when data is in memory. With a program-supplied eviction policy, a file search runs faster than the default in-kernel policy system, and comparable policies under other frameworks, with and without memory pressure.