*BSD News Article 92381


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!cpk-news-hub1.bbnplanet.com!su-news-hub1.bbnplanet.com!news.bbnplanet.com!news.pbi.net!news5.crl.com!nntp.crl.com!usenet
From: "Jordan K. Hubbard" <jkh@FreeBSD.org>
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Linux or FreeBSD (or something else?)
Date: Sun, 30 Mar 1997 21:15:04 -0800
Organization: Walnut Creek CDROM
Lines: 27
Message-ID: <333F4858.167EB0E7@FreeBSD.org>
References: <3337e3ad.1847437@news.sprynet.com> <5hbh2g$gah$1@kayrad.ziplink.net> <333990e3.2587820@news.sprynet.com> <5hlju0$ftk$1@news.belwue.de> <5hmlnk$c3m@dfw-ixnews4.ix.netcom.com> <333EE7B4.237C228A@FreeBSD.org> <5hn11r$6gr@fido.asd.sgi.com>
NNTP-Posting-Host: time.cdrom.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.01 (X11; I; FreeBSD 2.2-STABLE i386)
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:38119

Larry McVoy wrote:
> 
> Jordan K. Hubbard (jkh@FreeBSD.org) wrote:
> : That's all complete bollocks, unfortunately.  For one thing,
> : "mutlthreading" is something which can take place at two levels, the
> : application layer (POSIX threads) and the kernel.  You DO NOT NEED
> : kernel threads to do effective multithreaded applications, just working
> : user-mode threads (which FreeBSD has, including a specialized version of
> : libc which is thread safe).
> 
> So what happens when a thread blocks in read(2)?

From the man page [where "d" is the descriptor]:

In the non-threaded library read() is implemented as the read syscall.

In the threaded library, the read syscall is assembled to
_thread_sys_read() and read() is implemented as a function which locks d
for read, then calls _thread_sys_read().  If the call to
_thread_sys_read() would block, a context switch is performed. Before
re-turning, read() unlocks d.

[same rigamarole for readv()]

-- 
- Jordan Hubbard
  FreeBSD core team / Walnut Creek CDROM.