The full picture
- Layer stack to narrate: syscall → VFS (the polymorphic interface every FS implements — 'file systems are strategy objects') → page cache → concrete FS (ext4/XFS: offset→extent mapping) → block layer (merge/sort/schedule) → driver → device (DMA + interrupt).
- The page cache is why 'disk reads' are usually memory reads: free RAM is spent caching file pages (that's the confusing
free -hbuff/cache column — it's available). Second read of a file = pure memcpy. Databases either embrace it (Postgres) or bypass it with O_DIRECT to manage their own (Oracle, and Kafka's design leans on the cache deliberately). - 'Blocked' is free: while the disk works, your thread is off the run queue — the CPU runs someone else. Blocking I/O wastes a thread, not a core — the precise statement that motivates both epoll and virtual threads (they attack the wasted-thread problem, not a wasted-CPU problem).
- Writes are the mirror with a twist:
write()usually just dirties page-cache pages and returns — the disk write happens later (writeback). Durability is a separate contract — the fsync question, two questions down.