*BSD News Article 83200


Return to BSD News archive

Newsgroups: comp.unix.bsd.freebsd.misc
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!news.mel.connect.com.au!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!uunet!in3.uu.net!news.maz.net!news.ppp.net!news.Hanse.DE!wavehh.hanse.de!cracauer
From: cracauer@wavehh.hanse.de (Martin Cracauer)
Subject: Re: Threading
Message-ID: <1996Nov18.094942.21368@wavehh.hanse.de>
Organization: BSD User Group Hamburg
References: <554o8n$9hb@wormer.fn.net> <55nqeo$7d2@plains.nodak.edu> <3289939D.414A@wgold.demon.co.uk> <1996Nov13.165401.2044@wavehh.hanse.de> <56ffr0$o01@Mercury.mcs.net>
Date: Mon, 18 Nov 96 09:49:42 GMT
Lines: 45

tundra@MCS.COM (Tim Daneliuk) writes:

>In article <1996Nov13.165401.2044@wavehh.hanse.de>,
>Martin Cracauer <cracauer@wavehh.hanse.de> wrote:

[...]
>>On systems of the FreeBSD-2.2-family (that are snapshots and -current
>>until a few days ago and a ALPHA release RSN) you can go to
>>/usr/src/lib/libc_r and do a `make install` there. You have to have
>>the sources and rebuild them, they are not normally installed on
>>binary snapshots or distributions.
>>
>>libc_r is a library that includes a pthreads package (derived from MIT
>>pthreads) and replacements for parts of the C library to make them
>>thread-save.
>>
>>I've been called you can move the library (and include files) over to
>>2.1.5 and use them there, but I didn't try that by myself.
>>

>However, these are really just user-space threads, right?  That is, the kernel
>itself is still not multi-threaded as I understand it.  This means that
>you have the API illusion of threading, but when a thread blocks in user
>space, the whole process context in which it is running is also blocked.

The libc_r library is supposed to exchange calls to blocking system
calls with functions that call a non-blocking version, suspend the
thread that called it and to shedule other threads until the
asynchronos system call returns and the thread that called it is woken
up again. I don't know how much of this has been done, you might ask
freebsd-questions@freebsd.org if you need further details.

As far as I know, all this works and is used in production at least by
the one that contributed it to FreeBSD. (I didn't, but that is not
because I found it to be bad, just hadn't had the time to look into
it). 

BTW, it is not useful to use kernel threads to avoid the blocking
system call problem. Kernel-level threads require much more work on
resheduling, the solution at user level definitivly faster.

Martin
-- 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Martin Cracauer <cracauer@wavehh.hanse.de>  http://cracauer.cons.org