3 ms·
When creating a file handle you can usually specify how buffering will work. You can also say that everything should be written immediately. But even then there
by ygra 12y ago
When creating a file handle you can usually specify how buffering will work. You can also say that everything should be written immediately. But even then there can be buffering inside the disk and cause you to lose the data. That's not the file system's fault. And sure, get rid of all those caches in between if you don't care about performance. You can do that.
And "write to the file" usually says "write to the file at a point convenient for you". Heck, it's an asynchronous call most of the time anyway so it cannot complete immediately for obvious reasons.
- cnvogel 12y ago> But even then there can be buffering inside the disk this, the system accounts for. If you tell the OS to sync data to disk, it has to make sure that the disk committed the data to the durable media. One aspect of this is: As the disk, as long as it has unwritten cached data in its internal RAM cache, is free to write that data basically in any order, the OS will have to send a write barrier to the disk. Wouldn't this been accounted for by the OS, all filesystems would basically be completely broken on most power outages. Or one would have to flush the disk cache completely on every single and small change, which would severely degrade performance.
- icebraining 12y agoOn the other hand: http://queue.acm.org/detail.cfm?id=2367378 http://queue.acm.org/detail.cfm?id=2367378