Can UNIX pipe connections be compiled?

uunet!bria!mike uunet!bria!mike
Sun Jan 20 12:40:48 AEST 1991


In article <1991Jan18.193234.216 at rucs.runet.edu> rucs.runet.edu!dana (Dana Eckart) writes:
>
>Does there exist a piece of software (or is it even possible) to compile
>a pipe?  In particular, suppose you had 
>
>	ls -l | fgrep "Dec" | cut -f 4
>
>is there anyway to compile the above pipeline so that the pieces can
>communicate more quickly.  I am looking for a general solution, not
>one that works only for the above example.

Unless I'm reading you wrong, you seem to think that pipes are some coded
mechanism for communication between processes; it isn't.  An (anonymous)
pipe is a temporary entity created in the filesystem by the kernel on
behalf of two related processes that want to communicate.  It is useful 
to think of a pipe as a regular file, in which one process is writing to on
one end, and another process is reading from on the other end.

Typically, a pipe can buffer up to about 5K of data flowing through the
pipe.  When the pipe "fills up", the writing process is blocked until
the reading process reads from the pipe.  Similarly, the reading process
will block on an empty pipe, until the writing process writes something.
Should the reading process die and the writing process attempt to write
on the pipe, a signal will be sent (SIGPIPE) to the offending writing
process (which tells it that there is no longer anything out there to
read from the pipe).  If this wasn't done, the writing process would deadlock
when the pipe buffer filled, waiting for a reading process that no longer
existed.

So, after this brief overview of piping, the answer is, no, you cannot
"compile" pipes to increase the speed of reads and writes to the pipe.
An excellent reference would be Bach's book on UNIX System V.
-- 
Michael Stefanik, Systems Engineer (JOAT), Briareus Corporation
UUCP: ...!uunet!bria!mike
--
technoignorami (tek'no-ig'no-ram`i) a group of individuals that are constantly
found to be saying things like "Well, it works on my DOS machine ..."



More information about the Comp.unix.questions mailing list