*BSD News Article 90053


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!news.mira.net.au!news.netspace.net.au!news.mel.connect.com.au!munnari.OZ.AU!news.ecn.uoknor.edu!news.ysu.edu!news.radio.cz!newsbreeder.radio.cz!news.radio.cz!CESspool!news.maxwell.syr.edu!cpk-news-hub1.bbnplanet.com!cam-news-hub1.bbnplanet.com!news.bbnplanet.com!howland.erols.net!newsxfer3.itd.umich.edu!news1.best.com!nntp1.ba.best.com!usenet
From: Bryan O'Sullivan <bos@serpentine.com>
Newsgroups: comp.programming.threads,comp.unix.bsd.freebsd.misc
Subject: Re: [??] pure kernel vs. dual concurrency implementations
Date: 24 Feb 1997 19:38:46 -0800
Organization: Polymorphous Thaumaturgy
Lines: 40
Sender: bos@organon
Message-ID: <87afotwo55.fsf@serpentine.com>
References: <330CE6A4.63B0@cet.co.jp> <874tf7lbxc.fsf@serpentine.com>
	<3313372D.1849@cet.co.jp> <3313382C.29DA@cet.co.jp>
NNTP-Posting-Host: organon.serpentine.com
X-Newsreader: Gnus v5.3/Emacs 19.34
Xref: euryale.cc.adfa.oz.au comp.programming.threads:3301 comp.unix.bsd.freebsd.misc:36063

m> When would scheduler activations occur?

m> 1) When the current thread in a multi-threaded process blocks
m>    before its quantum is used up?

Only if the thread is blocking in a system call and the concurrency
level has been reduced as a result (by which I mean that the number of
runnable LWPs in that process has become lower than the number of
CPUs).  If the thread blocks on some kind of thread synchronisation
primitive, the user-level scheduler can simply schedule another thread
to run on the same LWP.

m> 2) When the LWPs are underutilized?

It is usually up to the user-level scheduler to manage deallocation of
a process's LWPs, since it has the clearest idea of whether or not an
idle LWP is going to be used soon.  There is no need for the kernel to
get involved here.

m> Also, who gets priority, runnable single-threaded processes or a
m> runnable thread in a multi-threaded process?

The Unix systems I am familiar with don't a priori favour
multithreaded processes over single-threaded processes, as that would
not be fair.

m> One more thing, does the userlib also schedule runnable
m> single-threaded process?

A single-threaded process will typically not be linked with the
threads library, so it won't even have a user-level thread scheduler
present.

	<b

-- 
Let us pray:
What a Great System.                   bos@eng.sun.com
Please Do Not Crash.                bos@serpentine.com
^G^IP@P6                http://www.serpentine.com/~bos