the buffer cache
A disk is thousands of times slower than memory, so reading the same block from disk over and over would be like driving to the library for every single fact when you could just keep the book open on your desk. The buffer cache is the kernel's desk: an area of RAM that holds recently used disk blocks, so that repeated reads are served from memory and writes can be batched up before they hit the slow disk.
It works in both directions. On a read, the file system first checks the cache; if the block is there (a hit) it returns instantly with no disk access, and if it is not (a miss) it reads from disk and keeps a copy for next time. Two optimizations make a big difference. Read-ahead (prefetching) notices sequential access and fetches the next few blocks before you ask, so streaming a file rarely waits on the disk. Write-behind (delayed write) lets a write return as soon as the data is in the cache, marking the block dirty and flushing it to disk later in the background — this batches many small writes and lets the OS reorder them efficiently. On modern systems the file buffer cache and the virtual-memory page cache are usually unified into one page cache, so memory-mapped files and ordinary reads share the same cached pages.
The buffer cache is one of the biggest reasons computers feel fast: most file accesses never touch the disk at all. But delayed writes carry an honest risk — if the machine loses power while dirty blocks are still in the cache and not yet on disk, those writes are lost. This is exactly why programs that must be sure (databases, editors saving your work) call fsync to force the cache to disk, and why file systems use journaling so a crash mid-flush leaves a recoverable state rather than a corrupt one.
Open the same config file twice in a row: the first read goes to disk and is slow; the second is instant because the blocks are still cached. Meanwhile, saving a document returns immediately — the data sits dirty in the cache and is written to disk a second later by a background flush.
Hot blocks served from RAM, writes batched and deferred — the cache hides most of the disk's slowness.
Delayed (write-behind) writes mean a save can succeed in your program but still be lost in a power failure before the flush. fsync forces the data out; without it the buffer cache's speed comes with a durability gap.