Coalescing pipe allocation

Robert Watson rwatson at FreeBSD.org
Tue Feb 3 09:14:40 PST 2004


On Tue, 3 Feb 2004, Dag-Erling Smørgrav wrote:

> Peter Edwards <peter.edwards at openet-telecom.com> writes:
> > Dag-Erling Smørgrav wrote:
> > > Peter Edwards <peter.edwards at openet-telecom.com> writes:
> > > > How would one "shut down" one direction of the pipe and still maintain
> > > > the other? I don't know how I can signal my intention not to read or
> > > > write to the end I leave open...
> > > man 2 shutdown
> > Shutdown requires a socket, and won't play with pipes:
> 
> hmm, you're right.  I was convinces that it was possible to shut down
> one half of a pipe...

At one point it may have been, when pipes were implemented using a
socketpair.  However, on recent FreeBSD, this is not the case.  Many
systems do implement pipes using socket pairs still, including Darwin. 
Our pipe implementation will typically substantially out-perform socket
pair implementations on the same hardware (often 150% or more for
throughput).  In fact, NetBSD recently picked up a modified version of our
pipe implementation for this reason, I believe.  However, it was
side-by-side benchmarking of the resources required to allocate pipes vs.
sockets that caused me to investigate optimizing the allocation process,
as it still costs a lot more to allocate a pipe than a socket pair. 

Robert N M Watson             FreeBSD Core Team, TrustedBSD Projects
robert at fledge.watson.org      Senior Research Scientist, McAfee Research




More information about the freebsd-current mailing list