CS FundamentalsModerateGATE CS

A file system uses a buffer cache with write-back. The system crashes right after a program's write() returned. Which statement is correct?

  1. A. The data is guaranteed on disk because write() returned
  2. B. The file is always corrupted beyond repair
  3. C. Write-back caches only affect reads
  4. D. The data may be lost, because write() returned after copying to the cache, not after reaching disk; fsync() forces it to stable storage

Correct answer: D. The data may be lost, because write() returned after copying to the cache, not after reaching disk; fsync() forces it to stable storage

Write-back delays disk writes for performance. Applications that need durability must call fsync()/fdatasync() or open with O_SYNC.

More Operating Systems questions

Exams that ask this topic