*BSD News Article 56697


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!news.ecn.uoknor.edu!paladin.american.edu!gatech!psuvax1!news.math.psu.edu!chi-news.cic.net!usc!howland.reston.ans.net!newsfeed.internetmci.com!in1.uu.net!newsfeed.pitt.edu!godot.cc.duq.edu!ddsw1!news.mcs.net!not-for-mail
From: les@MCS.COM (Leslie Mikesell)
Newsgroups: comp.unix.bsd.freebsd.misc,comp.unix.advocacy
Subject: Re: Win32 CreateThread() vs Unix fork()
Date: 12 Dec 1995 14:48:59 -0600
Organization: /usr/lib/news/organi[sz]ation
Lines: 30
Message-ID: <4akprr$i4i@Mercury.mcs.com>
References: <4ab85f$idq@news.voicenet.com>
NNTP-Posting-Host: mercury.mcs.com
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:10295 comp.unix.advocacy:12095

In article <4ab85f$idq@news.voicenet.com>, 900RR <900RR> wrote:
>
>Win32's CreateThread() is an extremely fast and efficient way of
>implementing multi-threaded, multi-user server applications (like Web
>servers). Threads are then run on individual processors in SMP boards,
>further boosting throughput.
>
>By contrast, Unix uses fork() to start an entire new process to
>service client requests. MP unixes could then run these whole
>processes on different CPU's.
>
>In any case, does anyone know how much more efficient a server
>application could run under an NT system than the same app, same
>hardware on something like FreeBSD or Linux? 
>
>Do veteran Unix programmers avoid fork() like the plague?

Web servers are an exceptional case and the trend seems to be
to fork() some processes in advance, then hand the waiting
child a new request.  In most cases fork() is the programmer's
friend because it means that the child process can freely
trample on global variables and library state variables without
concern for it's parent, and likewise can exec() another program at
any time.  I have yet to see real timing results that show
a big advantage for threads, although I can see where they would
be handy for doing things in the background that need access to
shared memory, like spellchecking. 

Les Mikesell
  les@mcs.com