
Keean Schupke wrote:
read. I don't see the problem... (Okay, I can see that if select lies, and the read takes a long time you might miss the next scheduling timeslot - but as far as I am aware select doesn't lie, and read will return immediately if select says there is data ready)...
select() _does_ lie for "ordinary files", e.g., disk files. It assumes the data is immediately readable, even if it hasn't pulled it off disk yet. If the "ordinary" file actually resides on an NFS volume, or CD, or something else slow, then you have a problem.
But the kernel does read-ahead so this data should just be a buffer copy.
You can't rely upon the kernel always having read the data already.
E.g. a program which performs trivial operations on large files may
well be able to consume the data faster than the kernel can obtain it.
--
Glynn Clements