From owner-freebsd-threads@FreeBSD.ORG Sat Feb 19 19:20:51 2005 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3A40B16A4CE for ; Sat, 19 Feb 2005 19:20:51 +0000 (GMT) Received: from mail.ntplx.net (mail.ntplx.net [204.213.176.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id CE86F43D39 for ; Sat, 19 Feb 2005 19:20:50 +0000 (GMT) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) j1JJKnUq005208; Sat, 19 Feb 2005 14:20:49 -0500 (EST) Date: Sat, 19 Feb 2005 14:20:49 -0500 (EST) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: Kazuaki Oda In-Reply-To: <4217707F.9050907@highway.ne.jp> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.ntplx.net) cc: threads@freebsd.org Subject: Re: thread accounting in libpthread X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Daniel Eischen List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Feb 2005 19:20:51 -0000 On Sun, 20 Feb 2005, Kazuaki Oda wrote: > Daniel Eischen wrote: > > > kse_check_completed() is called after kse_wait(). Do you > > have local changes that removed it? > > > > No, I have not changed. kse_check_completed() is called after kse_wait(). > What I meant in the past e-mail was that in such case there was no > running thread, > and so we did not needlessly switch it out. If there was no running thread before kse_wait(), then after kse_wait() returns and if there are completed threads, then either one thread completed or N threads completed. Either way, they are all added to the end of the run queue. But the run queue must have been empty to begin with, otherwise kse_wait() would not have been called. So it doesn't matter whether they are added to the head or the end of the queue. If one thread completes, then it will be run right away since it will be the only thread in the queue. If N threads complete (assuming they are all at the same priority) then the first thread pulled from the completed list will be run first since it will be the first thread added to the run queue. -- DE