Tim Peters wrote:
At least on Windows, both the flush and the fsync are necessary to see one million bytes (via a different process) at the first prompt, two million at the second, and so on. With neither, another process typically sees 0 bytes before the file gets huge. With just one of them, it seems hard to predict, ranging from 0 to "almost" a million additional bytes per prompt.
As Guido explains, fsync is not necessary for that kind of application on a POSIX system. Once write(2) has completed, all other processes immediately see the changed data.