Re: Coalescing pipe allocation

From: Dan Nelson <dnelson_at_allantgroup.com>
Date: Tue, 3 Feb 2004 12:56:10 -0600
In the last episode (Feb 03), Dag-Erling Smorgrav said:
> Robert Watson <rwatson_at_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_at_allantgroup.com
Received on Tue Feb 03 2004 - 09:56:15 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:41 UTC