BobJanova wrote:
The file should be locked against reading when it is actually being written. In a document editing app, that should be the time between pressing 'Save' and the save completing.
You make a very valid point there. However, the implementation holds some problems and I guess that's why it is the way it is now. I'm thinking that if Word would do that, and another program decides to start reading from the file (thus locking it temporarily for writes), any save or write from Word would have to wait until the other program releases its lock. Now, if it is a well behaved program, this might only take a few seconds, but then still, it adds a few seconds to any file write, which can be annoying. This problem you could work around by the OS caching the writes (or the reads) of the other program. Now, suppose the other program is not so well behaved and keeps the read lock for minutes. Then we have Word hanging, or if it's cached the responsibility of the OS to keep all changes to the file cached for a very long time. Well, I guess that it could work if the OS supported it. But only then. As it is now, any program that would try to be 'friendly' and release the lock between writes would become very vulnerable to IO-blocking by other programs. It could be done maliciously, for instance, to indefinitely halt execution of an application. It is indeed a tangent, but I find it interesting to think about the possibilities :)