As far as I can see, the only use of sync is to ensure that there's no incomplete information, which is supposed to be safely written on disk but may actually be still only in a volatile buffer. However, sync doesn't actually guarantee that at all — it merely schedules those buffers to be written, but doesn't wait for that to complete.

What's the point of that? If you really want to ensure the system is safe for shutdown, then you most certainly would want it to wait for that to be complete. (Likewise if you want all buffers empty before you start something latency-critical.) OTOH, if you want a program to continue right now and don't want to wait for buffers to be flushed, then why bother with sync at all? The buffers would be flushed anyways at some point when needed for other data.

This behaviour seems to have lead to some odd fairy tales about the need to sync multiple times.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.