From owner-freebsd-arch@FreeBSD.ORG Wed Mar 26 23:17:27 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A76E037B404; Wed, 26 Mar 2003 23:17:27 -0800 (PST) Received: from mail.chesapeake.net (chesapeake.net [205.130.220.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9193B43FA3; Wed, 26 Mar 2003 23:17:26 -0800 (PST) (envelope-from jroberson@chesapeake.net) Received: from localhost (jroberson@localhost) by mail.chesapeake.net (8.11.6/8.11.6) with ESMTP id h2R7HPl97392; Thu, 27 Mar 2003 02:17:25 -0500 (EST) (envelope-from jroberson@chesapeake.net) Date: Thu, 27 Mar 2003 02:17:25 -0500 (EST) From: Jeff Roberson To: David Xu In-Reply-To: <006a01c2f3ff$e57cb300$f001a8c0@davidw2k> Message-ID: <20030327020402.T64602-100000@mail.chesapeake.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Status: No, hits=-17.0 required=5.0 tests=AWL,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) cc: arch@freebsd.org Subject: Re: 1:1 threading. X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Mar 2003 07:17:29 -0000 On Thu, 27 Mar 2003, David Xu wrote: > After reading your 1:1 threading code, I think you needn't > hack current KSE code to build your own 1:1 threading code. > Our code allow you to do this, actully, it's my earlier > idea to let 1:1 be implemented in our M:N code base, but never > had told this to julian or others. It was actually done outside of KSE on purpose. It keeps the API simpler and cleaner. It keeps the implementation cleaner. It keeps it out of the majority of the KSE code paths aside from thread_suspend and related code. I wanted something small and stable that built on top of KSE provided primitives but did not actually use the KSE apis. This makes it easier for KSE to continue growing and changing while the 1:1 code remains simple. It also removes some of the cost associated with doing KSE. > if you want to create a thread, you can always call kse_create > syscall(the name should be changed to another, for example > upcall_create), the newly created upcall will be scheduled a > kernel thread on it and return to userland thread stack and > thread function, if you want to implement 1:1, you can always > set kse_mailbox.km_curthread to NULL, this ensures that userland > stack always has fixed association with kernel thread stack, > for me, 1:1 only means userland stack has fixed association with > kernel thread stack, no more. however, code in kse_create should be > adjusted to allow NUPCALLS > NCPUS, this allows 1:1 mode to be > implemented. thr_exit can be implemented to use kse_exit, and maybe > a wrapper to for kse_exit. > For thr_kill, I think we may add an API to allow a kernel > thread be identified by using kse_mailbox pointer or something > similar. I intend to keep thr_kill as is since it is the most simple and direct way to acomplish the POSIX semantics. > By implementing 1:1 code in current M:N code base, benifit is very > clear, a ksegrp protects time quantum and threads priority, and if > you want to implement a system scope thread(I know pthread has this > requirement), just call kse_create with newgroup parameters is 1, > you will immediately get a system scope thread. I have considered using the ksegrp for this purpose but I view that as an advanced feature not required to get threading off the ground. I'm trying to take reasonable steps that provide functionality all along the way. > Yes, you may think that KSE progress is slow, but I'd like to think KSE progress has been far too slow. Many people are migrating away from freebsd for other platforms due to our lack of threading. This project has been underway for a significant amount of time. I did the 1:1 threading because I view this as the most reasonable way to get good threading in a short period of time. > harder before pushing some not well thinked code into kernel. It is quite well thought out. Given the track record of the KSE project I actually take some offense to the suggestion that my code is not well thought out in comparison. > At least, when I am thinking about M:N, I am also thinking about > 1:1, I guess some people like 1:1, and others like M:N, so more choise is good. > > David Xu Yes, I think they both have their place. I think we can support both in the tree as well. Hopefully the 1:1 code will address most users needs until M:N is production ready. Cheers, Jeff > ----- Original Message ----- > From: "Jeff Roberson" > To: > Sent: Wednesday, March 26, 2003 11:00 AM > Subject: 1:1 threading. > > > > I just sent a mail to arch@ about a parallel effort that you all may be > > interested in. Please follow up there. > > > > Thanks, > > Jeff >