5 ms·
I ran across a nice paper a few years ago: Rethink the Sync. https://www.usenix.org/legacy/event/osdi06/tech/nightingale/nightingale.pdf https://www.usenix.org
by marvy 11y ago
I ran across a nice paper a few years ago: Rethink the Sync.
https://www.usenix.org/legacy/event/osdi06/tech/nightingale/nightingale.pdf https://www.usenix.org/legacy/event/osdi06/tech/nightingale/...
The basic idea is that the file system provides two guarantees, one boring, and one interesting. I'll illustrate using code instead of words. The boring guarantee is:
FILE* f = fopen("autosave.bak", "w");
fwrite(f, buffer, length); // save current document
fclose(f);
The system will try to make the write durable within 5 seconds of executing the second line. The interesting guarantee is this:
FILE* f = fopen("autosave.bak", "w");
fwrite(f, buffer, length); // save current document
puts("Saving complete!")
fclose(f);
The system guarantees that the user will not see the message until the data is safely on disk! The way they do this is to implement a fancy dependency tracking mechanism that makes sure that the computer never generates output until the writes that the output depends on have completed.
They do a bunch of benchmarks that show that their system is almost as fast as mounting ext3 _asynchronously_. (In fact, not much worse than a RAM disk even.) Of course, they also show that in the case of power loss, their system behaves well, whereas ext3 does not, unless you turn up all the paranoia knobs to 11, and then the performance is WAY worse than their system.
I'm oversimplifying quite a bit, since this comment is already pretty long. Read the paper for details. Or ask questions here, but I'll probably forget to check the comments, because HN doesn't remind me :(
- marvy 11y agoLooks like I remembered, but there aren't any comments.
- planckscnst 11y agoI misread this comment and it could be dangerous if someone who doesn't know misreads it the same way. So I want to put a big warning here. Warning! This comment is _not_ saying that your operating system provides these guarantees. In fact, it almost certainly does not. This is a novel suggestion (and implementation?) presented in this particular paper.
- marvy 11y agoYes, definitely! If the edit timer hadn't expired, I would rewrite this. I wrote this in a horribly unclear way.