From owner-freebsd-questions Sat Jan 20 13:19:56 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id NAA20945 for questions-outgoing; Sat, 20 Jan 1996 13:19:56 -0800 (PST) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id NAA20926 for ; Sat, 20 Jan 1996 13:19:44 -0800 (PST) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id OAA12171; Sat, 20 Jan 1996 14:09:03 -0700 From: Terry Lambert Message-Id: <199601202109.OAA12171@phaeton.artisoft.com> Subject: Re: streams To: chuckr@glue.umd.edu (Chuck Robey) Date: Sat, 20 Jan 1996 14:09:03 -0700 (MST) Cc: wollman@lcs.mit.edu, leisner@sdsp.mc.xerox.com, freebsd-questions@FreeBSD.org In-Reply-To: from "Chuck Robey" at Jan 19, 96 08:47:52 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-questions@FreeBSD.org Precedence: bulk > > It is well-known to be disadvantageous to actually /use/ streams. > > Garrett, I originated this stream, asking Mike Smith if he knew of any > streams-negativisms. Sounds like you do, would you care to amplify? I'm > really curious, because they seem like (to me) an analog to stackable > filesystems, for character io. Why not? Garrett will probably answer too, but your analogy fails. The file system stacking works by using a call vector table for the top end of the FS, and percolating call vectors up from the lower layers for null layers in the current layer. Which is to say, it has minimal overhead. In Streams, the upcall/downcall mechanism can't easily "collapse" empty layers to get similar efficiency. This leads to large latencies in Streams, while the stacking vnode interface only adds overhead for interfaces that actually do something, not just pass the call on. Streams is typically scheduled to run just before a process exits the system call trap code back to user space after a system call, with several additional preemption points where streams will preferrably run. But each layer traversal requires Streams to be scheduled to run, so a traversal of a full TCP/IP stack with an underlying DDI/DKI driver at the stream tail can take upwards of 6 or 7 preemption points to actually run. There has been some work on "monoblock" protocol implementations, where you have a single module with promiscuous knowledge of interfaces internally that exports multiple stack interfaces. For instance, I could have a single module that exported TCP, UDP, IP, ICMP, and RIP interfaces, but internally used non-Streams techniques to communicate between layers. This work is not very practical for more than a couple of high performance Streams heads, with everything built on top of them (the code reuse argument that semi-justifies streams in the first place) suffering the same penalties as usual because of the use of ordinary streams interfaces. The closest work to a stackable vnode architecture has been X-Kernel, though it has its own problems of stack implementation availability... it works, but there's very little to run. Probably, it would take kernel threading and pseudo-RT scheduling class support to make much of the latency go away. Then, on top of that, you would probably want to pass around data pointers rather than copying data into an mbuf when crossing the user/kernel boundry. This adds the mapping complication of not having the caller process context at the time Streams is actually run, so you would have to establish fixed kernel mappings for pages, and the user/kernel boundry crossing would seek to establish a translation for the fixed mapping address. So the primary utility for streams is for use of stack drivers from commercial sources and for the simplified developement environment (justified if you consider Streams stacks to be prototypes rather than production code. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.