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?
- A. The data is guaranteed on disk because write() returned
- B. The file is always corrupted beyond repair
- C. Write-back caches only affect reads
- 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
- Which of these is the correct reason that the Unix rename(old, new) within one file system is widely used to update a file safely (write a…
- A process opens the same file twice with two separate open() calls, getting fd 3 and fd 4, and also calls dup(3) to get fd 5. It then…
- After fork(), a parent and child both write to a file descriptor that was opened before the fork, without OAPPEND. Why do their writes not…
- Which statement about access-control lists (ACLs) versus capability lists is correct?
- A setuid-root program calls access(path, ROK) to check the real user may read path, then calls open(path). Which vulnerability does this…
- Which defence makes a stack-buffer-overflow attack that jumps to injected shellcode on the stack fail, even if the return address is…