From owner-freebsd-threads@FreeBSD.ORG Wed Jul 5 05:46:47 2006 Return-Path: X-Original-To: freebsd-threads@freebsd.org 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 32A5016A4DE; Wed, 5 Jul 2006 05:46:47 +0000 (UTC) (envelope-from julian@elischer.org) Received: from a50.ironport.com (a50.ironport.com [63.251.108.112]) by mx1.FreeBSD.org (Postfix) with ESMTP id DBEEC43D55; Wed, 5 Jul 2006 05:46:46 +0000 (GMT) (envelope-from julian@elischer.org) Received: from unknown (HELO [192.168.2.4]) ([10.251.60.25]) by a50.ironport.com with ESMTP; 04 Jul 2006 22:46:46 -0700 Message-ID: <44AB5243.6050905@elischer.org> Date: Tue, 04 Jul 2006 22:46:43 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.13) Gecko/20060414 X-Accept-Language: en-us, en MIME-Version: 1.0 To: David Xu References: <20060703101554.Q26325@fledge.watson.org> <44AAC47F.2040508@elischer.org> <200607050706.33502.davidxu@freebsd.org> <200607050724.18740.davidxu@freebsd.org> <44AB46CF.9030503@elischer.org> <44AB4C31.5090402@freebsd.org> In-Reply-To: <44AB4C31.5090402@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Daniel Eischen , Robert Watson , freebsd-threads@freebsd.org Subject: Re: Strawman proposal: making libthr default thread implementation? X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jul 2006 05:46:47 -0000 David Xu wrote: > Julian Elischer wrote: > >> the original aim for the ksegrp was not for fair scheduling but to >> allow libraries to instanciate >> their own threads in a way that they did not impact the application's >> threads in any way. >> Effectively, running them in their own process.. Fair scheduling just >> made use of it as a convenient >> abstraction. >> Removing the ksegrp entirely just reduces everything down to being >> boring threads with no possibility of >> ever doing anything different. >> >> KSEs have already gone, except as a scheduler abstraction. >> and having KSEGROUPs shouldn't affect anything negatively from no on. >> though they could be renamed threadgroups now. >> > > but it still has bias to M:N, the kg_user_pri member which is not right > for 1:1 thread, this also makes user interaction detection algorithm > impossible, e.g one thread is cpu-bound while another thread is > user-interaction thread, this model will make it impossible, > and two threads will be treated as cpu-bound, the concurrency limit > in ksegrp(4bsd/ule scheduler) also makes cpu-affinity algorithm to > be more diffcult, as kern_switch.c will withdraw a thread from > scheduler runqueue by a very simple reason - concurrency level. well then have a separate KSEG for each thread.. > >> The scheduler complexities we see now do not come from having >> ksegrps, but rather, from trying to >> do fair scheduling in the rather simplistic "obvious" manner that I >> did. I am truely >> surprised that someone has not come up with a better way to do it by >> now. I was expecting that >> the current approach would have been replaced by something more >> sophisticated by now. >> > > I would like to see a top level long term scheduler to adjust > decay factor as Solaris did, this would make fairness better than > ksegrp, ksegrp mechanism still can only manage a process but has > above issues. if you have a single KSEG for each thread, then you are welcome to have another method of producing thread fairness. if it can be shown to work then we can make ithte default way to run.. As I said, I did this work kbecause FreeBSD NEEDED threads and no-one was doing it, but I am pretty agnostic on how they should be implemented for the acerage thread user.