From owner-freebsd-hackers Mon Apr 24 15: 9:52 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from mta2.rcsntx.swbell.net (mta2.rcsntx.swbell.net [151.164.30.26]) by hub.freebsd.org (Postfix) with ESMTP id D795837B5AA for ; Mon, 24 Apr 2000 15:09:49 -0700 (PDT) (envelope-from chris@holly.calldei.com) Received: from holly.calldei.com ([208.191.155.7]) by mta2.rcsntx.swbell.net (Sun Internet Mail Server sims.3.5.2000.01.05.12.18.p9) with ESMTP id <0FTJ00IP8K3Q4R@mta2.rcsntx.swbell.net> for freebsd-hackers@FreeBSD.ORG; Mon, 24 Apr 2000 17:07:02 -0500 (CDT) Received: (from chris@localhost) by holly.calldei.com (8.9.3/8.9.3) id RAA15195; Mon, 24 Apr 2000 17:07:01 -0500 (CDT envelope-from chris) Date: Mon, 24 Apr 2000 17:07:00 -0500 From: Chris Costello Subject: Re: Multithreaded server performance In-reply-to: <20000424141957.W337@beastie.localdomain> To: Brian O'Shea Cc: Daniel Eischen , Jason Evans , A G F Keahan , freebsd-hackers@FreeBSD.ORG Reply-To: chris@calldei.com Message-id: <20000424170700.A14783@holly.calldei.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii User-Agent: Mutt/0.96.4i References: <20000424010315.U337@beastie.localdomain> <20000424141957.W337@beastie.localdomain> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Monday, April 24, 2000, Brian O'Shea wrote: > On Mon, Apr 24, 2000 at 06:13:53AM -0400, Daniel Eischen wrote: > > On Mon, 24 Apr 2000, Brian O'Shea wrote: > > > > > > I was under the impression that, because user thread scheduling is done > > > in user mode, a thread that goes to sleep calling a blocking read() > > > system call will put the entire process to sleep until that read() > > > returns (and so all user threads in the process will also be blocked). > > > Is this correct? > > > > 1. You are mistaken. > > Could you elaborate? The text that I am using [1] warns about blocking > system calls putting the process (and thus all user threads) to sleep. > This book has no FreeBSD specific information, so anything specific to > FreeBSD would be really interesting to hear. FreeBSD's threads implement has its own read() function which will make a non-blocking read() call (using the _real_ syscall) for the specified amount of bytes. Now a non-blocking read() call fails unless all the data in nbytes can be read into buf. So our implementation will continue to do a non-blocking read until all the data can be copied and then allows the thread continue, thus blocking only the calling thread. At least that's what the source code tells me. -- |Chris Costello |I smell a wumpus. `---------------------------------- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message