Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!hsdndev!rutgers!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.unix.internals Subject: Re: Regular pipe vs. Named Pipe Message-ID: <14192:Jun923:16:0791@kramden.acf.nyu.edu> Date: 9 Jun 91 23:16:07 GMT References: <1991Jun7.195953.27744@digi.lonestar.org> <14079@dog.ee.lbl.gov> Organization: IR Lines: 37 In article <14079@dog.ee.lbl.gov> torek@elf.ee.lbl.gov (Chris Torek) writes: > In article <1991Jun7.195953.27744@digi.lonestar.org> > cfoughty@digi.lonestar.org (Cy Foughty) writes: > >What are the differences between a regular pipe and a named pipe? > The main difference is that one has a name and one does not. Pipes are part of UNIX. Named pipes aren't. Named pipes appear in most (all?) System V releases and some BSD-derived releases, notably SunOS and Ultrix (where they are also called ``ports''). Named pipes are formalized by POSIX, with a slightly different behavior from that in any existing system. Pipes in POSIX are defined as special cases of named pipes. Pipes under Ultrix are not special cases of named pipes; they're implemented separately. Pipes under straight BSD are special cases of UNIX-domain sockets. (You can see most of this from the output of my pff program... ah, shaddap, Dan.) Basically, pipes work the same way everywhere, and named pipes don't. The name part of named pipes is their least portable aspect. Never use them in a long-lived program if you can use any other communications mechanism. > >Which type of pipe is faster and by how much? > >Which is faster, a named pipe or a message queue? > >Does a named pipe always go to disk or only when the allocated > >memory is exhausted? > All of these are implementation-dependent. On systems where pipes and named pipes use the same mechanism, neither one is faster (obviously). Under Ultrix they appear to run at the same speed anyway. Message queues are uniformly slower in my tests. On systems where named pipes are implemented in terms of sockets, they don't go to disk; under at least some versions of Ultrix they do go to disk. Basically, what Chris said. ---Dan