{
  "slug": "buffered-io",
  "term": "Buffered I/O",
  "aliases": [],
  "definition": "Buffered I/O is file access through an operating-system cache, allowing transfers between an application and storage to be decoupled.",
  "note": "For Linux iomap, buffered reads use page-cache folios and buffered writes dirty them for later writeback. This is distinct from a language runtime's stream buffer or an SSD's device cache. [iomap]\n\nWriteback thresholds decide when dirty cache pages reach storage. In Linux v6.16 the defaults start background writeback at 10% of available memory and make writing processes start writeback themselves at 20%. The default periodic wakeup interval is 5 s, and 30 s is the dirty-age threshold for eligibility for writeout, not a durable-completion deadline. [vm-sysctl] [writeback-src]\n\nThe percentages apply to available memory, meaning free plus reclaimable pages, not total system memory. Setting the wakeup interval to zero disables periodic writeback altogether. [vm-sysctl]\n\nDisabling periodic wakeups does not disable every writeback trigger or make dirty data persistent. For a completion requirement, check the result of the appropriate synchronization operation, such as fsync(); syncing a file does not by itself synchronize its directory entry. [vm-sysctl] [fsync-api]",
  "advantages": [
    {
      "text": "Allows cache reuse and writeback rather than requiring every application transfer to reach storage immediately.",
      "citationIds": [
        "iomap"
      ]
    },
    {
      "text": "Many small application writes can be absorbed in memory and written out later by background flusher threads.",
      "citationIds": [
        "vm-sysctl"
      ]
    }
  ],
  "limitations": [
    {
      "text": "Successful buffer updates alone are not persistence evidence; mixing access paths can require coherence work.",
      "citationIds": [
        "iomap"
      ]
    }
  ],
  "related": [
    "page-cache",
    "direct-io",
    "write-back-cache",
    "fsync",
    "posix-fadv-noreuse",
    "posix-fadv-dontneed",
    "rwf-dontcache",
    "rwf-nowait",
    "posix-fadv-willneed",
    "readahead",
    "fuse",
    "wsbuffer",
    "linux-writeback-throttling",
    "data-sieving",
    "streamcache"
  ],
  "citations": [
    {
      "id": "iomap",
      "label": "Linux v6.17 iomap",
      "title": "Linux v6.17: iomap supported file operations, sections 2.2.1-2.2.3.",
      "url": "https://www.kernel.org/doc/html/v6.17/filesystems/iomap/operations.html",
      "accessed": "2026-10-14"
    },
    {
      "id": "vm-sysctl",
      "title": "Linux v6.16 documentation: /proc/sys/vm, dirty_background_ratio, dirty_ratio, dirty_expire_centisecs and dirty_writeback_centisecs",
      "url": "https://www.kernel.org/doc/html/v6.16/admin-guide/sysctl/vm.html",
      "accessed": "2026-11-05"
    },
    {
      "id": "writeback-src",
      "title": "Linux v6.16 mm/page-writeback.c: default dirty ratios and writeback intervals",
      "url": "https://github.com/torvalds/linux/blob/v6.16/mm/page-writeback.c",
      "accessed": "2026-11-05"
    },
    {
      "id": "fsync-api",
      "title": "Linux man-pages: fsync(2), completion, return value and directory-entry scope",
      "url": "https://man7.org/linux/man-pages/man2/fsync.2.html",
      "accessed": "2026-11-05"
    }
  ],
  "status": "shipping",
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-12-04",
  "provenance": [
    "vm-sysctl is the Linux v6.16 vm sysctl documentation, read on the access date in the dirty_* entries.",
    "writeback-src is mm/page-writeback.c at tag v6.16, read for the default values of the four tunables.",
    "10%, 20%, 5 s and 30 s come from writeback-src, where they appear as 10, 20, 5 * 100 and 30 * 100 centiseconds or percent.",
    "iomap was not reread and keeps its earlier access date.",
    "The 2026-11-05 correction distinguishes dirty-age eligibility, periodic wakeups and synchronization completion; vm-sysctl, writeback-src and fsync-api were reread."
  ]
}
