Short answer
ATOMIC_MOVE asks the filesystem to perform a rename as a single indivisible operation, so observers never see a partially written file — it either sees the old file or the complete new one.
Explanation
The standard safe-write pattern is to write to a temporary file, fsync it, then atomically move it over the target, which guarantees readers never observe a half-written or truncated file even if the process crashes mid-write. The caveat is atomicity is only guaranteed within the same filesystem; a cross-filesystem move can't be atomic and throws or degrades to copy-then-delete.
Common mistakes
- Writing directly to the final file, leaving half-written data on crash.
- Assuming ATOMIC_MOVE works across file systems.