Hi all,
I develop tests of an application which among other things write data to files, sync that data to disk with sync() (man 2 sync on Linux) and subsequently opens the same file, reads its contents and make sure that the read file contains the expected data.
What I see is that I have timing issues with when data is written to a file and when it is read, in other words, I sometimes manage to read data before it has actually been written, although the sequence of the operations are 1)write 2)read.
Linux supposedly flushes the OS buffer cache in response to a sync() call. This leaves the disk cache as a possible culprit, so my question is:
- Is the cache of a disk shared by all applications accessing the cache?
This is what a cache is to me as a software developer but perhaps you hw guys have another opinion?
Thanks
I develop tests of an application which among other things write data to files, sync that data to disk with sync() (man 2 sync on Linux) and subsequently opens the same file, reads its contents and make sure that the read file contains the expected data.
What I see is that I have timing issues with when data is written to a file and when it is read, in other words, I sometimes manage to read data before it has actually been written, although the sequence of the operations are 1)write 2)read.
Linux supposedly flushes the OS buffer cache in response to a sync() call. This leaves the disk cache as a possible culprit, so my question is:
- Is the cache of a disk shared by all applications accessing the cache?
This is what a cache is to me as a software developer but perhaps you hw guys have another opinion?
Thanks