Subject: Re: Faster pipes, now with uvm_loan()
To: NetBSD Kernel Technical Discussion List <tech-kern@NetBSD.ORG>
From: Greg A. Woods <woods@weird.com>
List: tech-kern
Date: 04/27/2001 21:47:45
[ On Friday, April 27, 2001 at 16:49:06 (-0700), Greywolf wrote: ]
> Subject: Re: Faster pipes, now with uvm_loan()
>
> To clarify to anyone who's never experienced "old" UNIX: Pipes used to
> be set up using a disk block, IIRC. Each process running piped would
> consume one such block. Or was it a block out of the cache (which was
> tied to a block on disk)?
>
> In either case, on-disk piping went away with (I *think*) 4.x BSD, possibly
> earlier (I seem to remember SVR2 still using on-disk pipes).
Yup, mostly right. In traditional Unix a pipe() call actually allocates
an inode from the "pipe device", and then uses just the ten direct
blocks that can be addressed from the inode itself (i.e. a total of 5120
bytes) for the pipe buffer. Since in traditional Unix all disk block
I/O goes through the buffer cache, pipes are always also buffered. Note
that Unix systems with FIFO files implement them by simply giving that
pipe inode a name in the upper layer of the filesystem directory
structure in order to create a "named pipe", and of course setting a
special mode bit to identify it as a FIFO (traditionally this is done by
mknod(), but for reasons unknown to modern Unix hackers the POSIX
committee invented mkfifo() instead).
All commerical AT&T Unix releases right up to, but not including, System
V Release 4.0 had traditional pipe() implementations. It wasn't until
SysVr4.0 that STREAMS were used to implement pipes (and FIFOs).
SysVr3.2 did have STREAMS by default, but still used traditional pipes.
Research Unix probably had streams-based pipes as early as the 9th
Edition (and certainly by the 10th, according to my copy of the manual),
and maybe even as early as the 8th (when streams were introduced).
BSD has had socket-based pipes (created using socketpair()) ever since 4.2
--
Greg A. Woods
+1 416 218-0098 VE3TCP <gwoods@acm.org> <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>