speaking of pipes...

bob at ucla-locus bob at ucla-locus
Wed Aug 3 04:06:18 AEST 1983


From:            Bob English <bob at ucla-locus>

Calling the kernel directly for each character is (admittedly) more
expensive than using stdio.  On the other hand, four copies per
character seems excessive, especially on virtual memory machines.
Why not, for example, have a block read/write call that swaps pages
in and out of the kernel rather than copying (I know "security risk!"),
or even a kernel smart enough to do the copy directly from user space
to user space when the pipe has a read pending.  If you really
wanted to get fancy (and dangerous), you could have the pipe call
set up an area of shared memory and implement a stream protocol
that would eliminate copies entirely.

I'm not suggesting that any of these be adopted, merely that,
compared to some other potential strategies, pipes have high
overhead.  In light of this, I think it's unreasonable to write
off four copies as the best we're going to get.  The pipe
concept is a good one, but the concept should not be confused
with the implemetation.

--bob--



More information about the Comp.unix.wizards mailing list