Asynchronous File I/O on Linux

Richard Pieri richard.pieri-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Wed May 19 14:52:44 EDT 2010


On May 19, 2010, at 1:09 PM, Bill Bogstad wrote:
> 
> lseek() is cheap since all the kernel has to do is change it's
> internal offset counter for the file descriptor associated with a disk
> file.

My understanding is that the largely depends on the actual implementation.  The behavior may vary from one Unix to the next.  That, and the results may be unexpected with sparse files.  I'm not sure how pread() and sparse files interact.

> It's only when you do the subsequent read() that any real cost
> is incurred.  Assuming uncached disk files, that is likely to require
> disk head seeks which is where the time cost comes into play and I see
> no way around that.

Pre-load the cache before you need to actually read() data.

--Rich P.







More information about the Discuss mailing list