[OpenAFS-devel] .35 sec rx delay bug?

Ken Hornstein (Contractor) kenh@cmf.nrl.navy.mil
Fri, 10 Nov 2006 13:37:29 -0500


>I'm not a guru, but I think that's not correct. pread/pwrite are  
>there to prevent some races, not to save time.

You are incorrect.  Those system calls were created at the behest
of large database vendors (among others).  They wanted to avoid
having to call lseek before read() and write() calls ... just to
save on the number of syscalls.  The same thing goes for readv()
and writev() (well, okay, readv() and writev() have been around
approximately forever).  Like Tom has already mentioned, they predate
the wide usage of threads and they have nothing to do with thread
safety.

>And at least in Linux  
>syscalls are _fast_, because there is no context switch (that term is  
>reserved for the switch between processes, as that is a _lot_ slower  
>than entering/exiting kernel space).

Of course, there are plenty of operating systems other than Linux.
But still, you incur overhead on a syscall (you are very likely
destroying cache locality).  They are to be avoided if possible, I
think we can all agree on that.

Getting back to my original point ... certainly sendfile() is worth
investigating, and I will give it a try when I get to that point.
One think I've discovered is performance is a slippery thing to get
ahold of.

--Ken