From owner-freebsd-threads@FreeBSD.ORG Sat Feb 19 13:52:33 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 29D5916A4CE; Sat, 19 Feb 2005 13:52:33 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id E10E643D2F; Sat, 19 Feb 2005 13:52:32 +0000 (GMT) (envelope-from davidxu@freebsd.org) Received: from [127.0.0.1] (davidxu@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.1/8.13.1) with ESMTP id j1JDqPXZ004132; Sat, 19 Feb 2005 13:52:28 GMT (envelope-from davidxu@freebsd.org) Message-ID: <42174545.7090404@freebsd.org> Date: Sat, 19 Feb 2005 21:55:17 +0800 From: David Xu User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.7.2) Gecko/20041004 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kazuaki Oda References: <42173C82.7040408@highway.ne.jp> <42174126.5000006@freebsd.org> <421742AC.9050509@highway.ne.jp> In-Reply-To: <421742AC.9050509@highway.ne.jp> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit cc: Daniel Eischen 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 13:52:33 -0000 Refreshed, I got it under x11: -------------------- thread 00: 25925 thread 01: 57635 thread 02: 24947 thread 03: 1187 thread 04: 13166 -------------------- the result seems a bit unfair. :) Kazuaki Oda wrote: > Yes. It is fair scheduling under console. My result is under xterm. > Could you run it under xterm or any other x11 terminal? > > > David Xu wrote: > >> I have run your program, here is the result: >> >> ... >> thread 04: countup >> thread 00: countup >> thread 01: countup >> -------------------- >> thread 00: 553150 >> thread 01: 562367 >> thread 02: 553351 >> thread 03: 532770 >> thread 04: 542718 >> -------------------- >> >> It is fair scheduling. I run it under console and no other programs >> are eating CPU >> time, note that I didn't run it under X11 terminal. >> >> David Xu >> >> 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 >>> 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. >>> >>> The reason why I am researching libpthread is that the attached >>> program shows >>> -------------------- >>> thread 00: 55666 >>> thread 01: 1161 >>> thread 02: 1112 >>> thread 03: 1112 >>> thread 04: 55494 >>> -------------------- >>> on xterm on my UP machine. This is a unexpected result. It seems >>> to me that >>> libpthread does unfair scheduling. But on SMP machine that program >>> shows >>> expected result and on console too... >>> >>> >>> -------------------- >>> Kazuaki Oda >>> > > >