in reply to Re: flock and read-ahead buffering on input
in thread flock and read-ahead buffering on input
I am worried about perl or the OS performing read-ahead buffering as a result of the sysopen call. I am aware that flock is advisory locking, not mandatory. And I am assuming a local file system.
Clearly read-ahead buffering is normally done (at least on linux), since this post, for example, discusses controlling linux's read-ahead buffer size, and this post discusses controlling the read-ahead buffer size from perl. Therefore, given that read-ahead buffering is normally done, how can the above code possibly be safe? I am fully prepared to believe that it is, but I have not been able to find any authoritative evidence to support that belief, and I want my code to be safe.
For example, if flock was guaranteed to invalidate the read-ahead buffer, or if the act of another process writing to the file was guaranteed to immediately invalidate the read-ahead buffer, or if the read-ahead buffer was guaranteed to not be filled until this process did a read on the file handle, then the above code would indeed be safe. Can anyone point me to any evidence that that any of these is true, or any other evidence that indicates why the above code is safe, given the fact that read-ahead buffering normally occurs when reading a file?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: flock and read-ahead buffering on input
by dave_the_m (Monsignor) on Apr 18, 2014 at 07:55 UTC | |
by dbooth (Novice) on Apr 18, 2014 at 17:46 UTC | |
by dave_the_m (Monsignor) on Apr 18, 2014 at 22:47 UTC | |
by dbooth (Novice) on Apr 19, 2014 at 05:03 UTC |