[NTLUG:Discuss] Disk I/O timings.
Richard Cobbe
cobbe at airmail.net
Thu Dec 6 08:45:29 CST 2001
Lo, on Wednesday, December 5, Steve Baker did write:
> I want to know *WHEN* the kernel transfers the data from the disk drive
> (or the disk drives cache) into the cache in main memory. Does it do it
> when I do the 'open' or when I 'mmap' the file - or when I first try to
> access the mmap'ed array to read the data? ...or perhaps at some other time?
<snip>
> OTOH, they might say "well, it's a waste of cache to load a file that *might*
> never be read" - and hence not bother to load it until I actually read
> some data out of that mmap'ed array (thereby causing a page fault and triggering
> the actual read).
In the absence of a disk cache, the data is loaded when you first access
the page, as you describe above. I don't know if Linux caches pages
managed by the virtual memory swap system at all, let alone if there's
an aggressive read-ahead mechanism, although your timing results suggest
that it does and there is.
I would think that for a real-time system, you would want much greater
control over the caching policy to be able to control situations like
this. (Of course, the exact policy choice may not be as important as
knowing which choice you've got and what its performance characteristics
are.)
Richard
More information about the Discuss
mailing list