{
  "slug": "msync",
  "term": "msync",
  "aliases": [
    "msync()"
  ],
  "definition": "msync is an operation that synchronizes a range of a shared file-backed memory mapping with its underlying file, with MS_SYNC waiting for completion.",
  "note": "On Linux, MS_ASYNC has been a no-op since 2.6.19 because dirty-page tracking already drives writeback; it is not a durability completion point. MAP_PRIVATE modifications do not update the backing file. MS_SYNC is not the distinct MAP_SYNC mapping flag used with DAX-capable files.",
  "status": "shipping",
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-10-13",
  "advantages": [
    "Provides explicit synchronization for a selected mapped range."
  ],
  "limitations": [
    "The starting address must be page-aligned; portable callers specify exactly one of MS_SYNC and MS_ASYNC.",
    "Does not make private mapping changes persistent or provide an atomic application transaction."
  ],
  "related": [
    "fsync",
    "fdatasync",
    "sync-file-range"
  ],
  "citations": [
    {
      "id": "msync-api",
      "title": "Linux man-pages 6.19: msync(2), flags and Linux behavior",
      "url": "https://man7.org/linux/man-pages/man2/msync.2.html",
      "accessed": "2026-10-13"
    },
    {
      "id": "mmap-api",
      "title": "Linux man-pages 6.19: mmap(2), shared/private mappings and MAP_SYNC",
      "url": "https://man7.org/linux/man-pages/man2/mmap.2.html",
      "accessed": "2026-10-13"
    },
    {
      "id": "hesela-fsync",
      "title": "Hesela: File and mapped-range synchronization boundaries",
      "url": "https://hesela.com/analyses/fsync-failure-retry-durability/",
      "accessed": "2026-10-13"
    }
  ]
}
