*BSD News Article 58116


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.mel.connect.com.au!munnari.OZ.AU!news.ecn.uoknor.edu!paladin.american.edu!zombie.ncsc.mil!news.duke.edu!agate!news.mindlink.net!van-bc!ddsw1!news.mcs.net!not-for-mail
From: les@MCS.COM (Leslie Mikesell)
Newsgroups: comp.unix.bsd.bsdi.misc,comp.unix.advocacy
Subject: Re: multiple httpds vs threads vs ... (was BSDI Vs. NT...)
Date: 25 Dec 1995 22:06:00 -0600
Organization: /usr/lib/news/organi[sz]ation
Lines: 32
Message-ID: <4bnsb8$1qe@Mercury.mcs.com>
References: <taxfree.3.00C439A1@primenet.com> <4bhfmp$gei@Mars.mcs.com> <DK5Crs.I77@metrics.com> <4bmsjp$7lv@elf.bsdi.com>
NNTP-Posting-Host: mercury.mcs.com
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.bsdi.misc:1832 comp.unix.advocacy:12643

In article <4bmsjp$7lv@elf.bsdi.com>, Chris Torek <torek@bsdi.com> wrote:

>It seems almost too obvious for words that, all else being equivalent,
>threads will be lighter-weight than processes, since a process is
>simply a thread with an address space, and changing address spaces
>has to have some cost.  The cost is machine-dependent; it is usually
>moderate but never zero.

But is this still true if you are doing i/o?  That is, don't you
have to go from kernel to application address space on every
packet anyway?

>On the other hand, if the threads provided are preemptive, a program
>that makes use of them must also use synchronization to be reliable.
>This synchronization has a cost as well, and it is easy to believe
>that this will rapidly eat away any savings from staying in a single
>address space.  (I leave the argument about the difficulty of
>getting such synchronization correct for another argument entirely,
>but would like to suggest that this is [part of] why operating
>systems were invented.)

Somewhere you've got to sort the packets out and decide which code
can run.  If this can be done better than the unix scheduler can
do it, why not fix that instead?

>That leaves non-preemptive threads, but for the most part, these can
>be implemented on top of select() or poll().

Doesn't that just double your syscalls/second?

Les Mikesell
  les@mcs.com