1:1 threading.

David Xu davidxu at freebsd.org
Thu Mar 27 01:25:20 PST 2003


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.
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.
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.
Yes, you may think that KSE progress is slow, but I'd like to think
harder before pushing some not well thinked code into kernel.
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

----- Original Message ----- 
From: "Jeff Roberson" <jroberson at chesapeake.net>
To: <kse at elischer.org>
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



More information about the freebsd-arch mailing list