*BSD News Article 29561


Return to BSD News archive

Xref: sserve comp.unix.bsd:13739 comp.unix.sys5.r4:7068
Newsgroups: comp.unix.bsd,comp.unix.sys5.r4
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msuinfo!agate!howland.reston.ans.net!europa.eng.gtefsd.com!MathWorks.Com!news.kei.com!ddsw1!chinet!les
From: les@chinet.chinet.com (Leslie Mikesell)
Subject: Re: IPC through named pipes
Message-ID: <CoKFHC.Bn9@chinet.chinet.com>
Keywords: named pipe, FIFO, buffer size
Organization: Chinet - Public Access UNIX
References: <2ov4ov$gg4@news.hal.com>
Distribution: usa
Date: Wed, 20 Apr 1994 16:07:59 GMT
Lines: 22

In article <2ov4ov$gg4@news.hal.com>, Vishy Dasari <vishy@hal.com> wrote:
>Hi All,
>	Is there any way I can increase the buffer sizes of a socket or a 
>named pipe (from the default 4096) ?  In my application process A writes
>to a named pipe millions of bytes while process B reads from it.  Right 
>now with the default size, the application runs very slow as the process
>A is frequently trying to write more than the MAX size of buffer and is 
>idling.  I guess, increasing the buffer size would help solve this
>problem.

It shouldn't be all that slow if the writer writes in chunks of
1/2 PIPE_MAX or less and the reader requests PIPE_MAX at once.
If you are using stdio it will probably help a lot to do your
own large read() and write() calls directly instead.
However, if you are talking about sysvr4, why don't you set
up a buffer in shared memory and use two pipes between your processes
simply to keep track of "puts" and "gets" into the shared area?  If
you treat it as a ring buffer of many blocks you can decouple
the access times of the processes quite a bit.

Les Mikesell
  les@chinet.com