Re: O.T. optimising file placement
On 2/23/2012 3:16 PM, Martin Gregorie wrote:
On Wed, 22 Feb 2012 21:40:19 -0500, Arne Vajh??j wrote:
Most OS'es support async IO.
Yes, I know, but its not relevant to a single-threaded process since its
logic generally requires it to wait for a read or write to complete
before it continues[1]. Hence my comment that this prevents head movement
being optimized unless a lot of processes are active because there's only
one outstanding IOP per process.
[1] unless you're deliberately doing async i/o using poll() or
select() (in C) or nio (in Java), in which case the process is often
best regarded as a half-way house between single and multi-threaded
logic.
There are some exceptions to this. For example, if you are reading a
file sequentially, the OS may prefetch blocks you have not yet
requested, and have multiple reads outstanding as a result.
Depending on the OS and how the IO is being handled, a write may appear
to be complete from the program's point of view once the data has been
copied to a kernel buffer. The OS may be writing out modified blocks,
including swap space blocks, at any time.
Patricia