Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Feb 2004 12:56:10 -0600
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Dag-Erling Smorgrav <des@des.no>
Cc:        current@freebsd.org
Subject:   Re: Coalescing pipe allocation
Message-ID:  <20040203185610.GA77596@dan.emsphone.com>
In-Reply-To: <xzpwu745c9k.fsf@dwp.des.no>
References:  <Pine.NEB.3.96L.1040203115210.79056E-100000@fledge.watson.org> <xzpwu745c9k.fsf@dwp.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Feb 03), Dag-Erling Smorgrav said:
> Robert Watson <rwatson@FreeBSD.org> writes:
> > Well, I don't know so much about the portability issues, but I can
> > say that it seems silly to incur the costs if few applications take
> > advantage of the feature.  Especially if the cost can be defered
> > until the feature is exercised.  I have some local patches that
> > defer all pipe buffer allocation until a particular direction is
> > first used, but this has some potential downsides, including
> > increasing the chances that a lack of resources is discovered on
> > first-use, rather than on allocation of the pipe (which makes it a
> > lot harder to write robust applications).
> 
> This is IMHO a lesser evil than the current behaviour, and there is
> always the option of blocking if memory can't be allocated right away.

How about always allocating at least enough for one direction (since I
don't think many people just call pipe() to use up fds), and deferring
allocation of the other direction until it's used?  I'm assuming it's
easy to swap the buffers around if you allocate the 0->1 direction but
for some reason the program decides to use the 1->0 one instead.  That
should cover the usual case.

-- 
	Dan Nelson
	dnelson@allantgroup.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040203185610.GA77596>