Making writes durable – is your data on disk?
Here is an interesting article written by Evan Jones. The article explains how you can be guaranteed when your data is on disk.
In case you’re wondering, when write(), fwrite() or any other library call that writes data to disk reports success you are not guaranteed that the data is actually on the disk. In fact, in Linux, write() reports success when data is in dirty cache. Then, special kernel thread kicks in and makes sure that the data is on disk.
Depending on circumstances, it may take some time until writer kernel thread will finish writing. Anyway, in his post Evan talks about how to make sure that the data is actually stable on disk.
Also this article is very interesting for detailed examples regarding syncing to disks:
http://lwn.net/Articles/457667/
Hydroleader, bureau d’études marocain installé à Marrakech et Rabat spécialisé en hydraulique
Bureau d’études hydraulique Maroc