Comparisons
Two things routinely conflated, put side by side. Neither column is the winner — what decides is the workload and the machine.
CPU cache vs OS page cache
Both are called "cache" and they are almost nothing alike. The CPU cache is hardware holding lines of physical memory and is invisible to software. The page cache is ordinary RAM the kernel uses to hold file data, is software-managed, and is thousands of times larger.
Nanosecond-scale, entirely automatic, no software involvement
Tiny, uncontrollable, and invisible in any profiler that looks at code
Reasoning about loop performance and data layout
Huge, inspectable, controllable, and it survives process exit
Costs a system call to reach, and competes with application memory
Reasoning about file I/O, database buffer pools and memory pressure
| Dimension | CPU cache | OS page cache |
|---|---|---|
| Managed by | Hardware | The kernel |
| Holds | Cache lines of physical memory | Pages of file data |
| Scale | Kilobytes to tens of megabytes | Up to most of RAM |
| Software can control it | Barely — only through access patterns | Yes, explicitly |