Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!think.com!zaphod.mps.ohio-state.edu!usc!elroy.jpl.nasa.gov!swrinde!cs.utexas.edu!convex!news From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.unix.questions Subject: Re: Can UNIX pipe connections be compiled? Message-ID: <1991Jan20.061658.24415@convex.com> Date: 20 Jan 91 06:16:58 GMT References: <1991Jan18.193234.216@rucs.runet.edu> <373@bria> Sender: news@convex.com (news access account) Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 42 Nntp-Posting-Host: pixel.convex.com From the keyboard of uunet!bria!mike (Michael Stefanik): :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. No, it's not. On BSD systems, pipe(2) is implemented as a semi-disabled version of socketpair(2). It's all IPC -- no filesystem activity is involved. All the work is not a Vax, nor is it SysV. :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 4k on my system. :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. This is all true and useful information. (As far as I know.) :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. But you can often rearrange your program so it doesn't shove the data through a bunch of processes' address spaces. A good example is the slow old makewhatis script, which runs much faster when coded do to the work entirely in one process. --tom -- "Hey, did you hear Stallman has replaced /vmunix with /vmunix.el? Now he can finally have the whole O/S built-in to his editor like he always wanted!" --me (Tom Christiansen )