3 ms·
If you are using write(2)/read(2) on a local file, is there any other buffer that comes into play aside from the memory in buffer cache itself? You are correct
by HerraBRE 15y ago
If you are using write(2)/read(2) on a local file, is there any other buffer that comes into play aside from the memory in buffer cache itself?
You are correct that obviously we don't really know when the data will hit disk, but that doesn't matter because the readers and writers are all hitting the same in-memory cache.
- rbehrends 15y agoWell, technically, the POSIX standard specifies that "After a write() to a regular file has successfully returned: ... Any successful read() from each byte position in the file that was modified by that write shall return the data specified by the write() for that position until such byte positions are again modified." How well any given operating system implements this and whether it properly considers all the aspects of multiple processes writing/reading to the same file is anybody's guess. Linux /should/ do it correctly, but as I recall, SQLite had some related issues with shared files on OS X a few years ago.