From owner-freebsd-threads@FreeBSD.ORG Sat Feb 19 17:00:22 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 7520E16A4CF; Sat, 19 Feb 2005 17:00:22 +0000 (GMT) Received: from mx.highway.ne.jp (pip7.usen.ad.jp [61.122.117.245]) by mx1.FreeBSD.org (Postfix) with ESMTP id 84A9143D53; Sat, 19 Feb 2005 17:00:20 +0000 (GMT) (envelope-from kaakun@highway.ne.jp) Received: from [219.195.104.17] (helo=[192.168.11.16]) by pop12.isp.us-com.jp with esmtp (Mail 4.20) id 1D2Xxp-0005hz-Sj; Sun, 20 Feb 2005 02:00:18 +0900 Message-ID: <4217707F.9050907@highway.ne.jp> Date: Sun, 20 Feb 2005 01:59:43 +0900 From: Kazuaki Oda User-Agent: Mozilla Thunderbird 1.0 (X11/20050101) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Daniel Eischen References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit cc: threads@freebsd.org Subject: Re: thread accounting in libpthread X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Feb 2005 17:00:22 -0000 Daniel Eischen wrote: > On Sat, 19 Feb 2005, Kazuaki Oda wrote: > >> Daniel Eischen wrote: >> >> >On Sat, 19 Feb 2005, Kazuaki Oda wrote: >> > >> >>And while looking at thr_kern.c, I've had one more question. >> >>In kse_switchout_thread, after calling thr_accounting thread is placed >> >>at the tail of run queue or at the head of it according to >> >>thread->slice_usec. >> >>But in kse_check_completed, thread is just placed at the tail of >> run queue. >> >>Is there any reason why thread is not placed at the head of run >> queue in >> >>case of thread->slice_usec != -1? >> >> >> >> >> > >> >Because it already blocked and we don't want to needlessly >> >switch out a currently running thread that hasn't used its >> >quantum. >> >> Blocked? I think that completed threads are *not* blocked and they are >> ready > > > Blocked is past tense above. It _had_ blocked in the kernel > and that gave other threads a chance to run. You don't add > it to the head of the queue because that makes it unfair to > the other threads that were in the queue. The default > scheduling is SCHED_RR in libpthread and that is laid > out by POSIX. Sorry for my misreading. I've understood what you mean. > >> to run except for suspended. And, kse_check_completed could be >> called after >> calling kse_wait. In this case there is currently no running thread. > > > 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. Thanks. -------------------- Kazuaki Oda