Msync
msync is a POSIX-compliant system call used to synchronize a memory-mapped region with its underlying file on disk. It serves to ensure that changes made to a mapped region are persisted and, in some cases, to refresh the region from the file after external updates.
The function has the form: int msync(void *addr, size_t length, int flags). Flags commonly include MS_SYNC, MS_ASYNC,
On success, msync returns 0. On failure, -1 is returned and errno is set to indicate the
msync is relevant when working with mmap’d files. Using MS_SYNC provides strong persistence guarantees but may
msync is available on most Unix-like systems implementing POSIX mmap, including Linux, macOS, and BSD variants.