4 ms·
That's still missing the point. Say you're writing a program that stores a log of transactions. People are trading resources and you log those transactions so y
by planckscnst 11y ago
That's still missing the point. Say you're writing a program that stores a log of transactions. People are trading resources and you log those transactions so you can find out who owns which resources. User A just gave 100 units to user B; you need to store this information and tell both users that the transaction is complete. How do you do that? Your program will do something like "write(t_log_fd, t_entry, t_bytes);". Can you now tell the users that the transaction is complete?
- rdtsc 11y agoI guess I have misunderstood, your question about "The article wasn't about the decision of when to write to disk". I thought you are asking how to control in general when your system is writing to disk. Well if you don't use fsync then it decides at some point like I mentioned above. If want to talk about transactions then do a write and fsync, does that not work someetimes fro you? If you are worried about the new file appearing in the directory then fsync the directory as well. If you want more guarantees, you'll have to dig deeper and find out about your specific device, does it have battery power and does it tell lies about it writing data and so on.