1:N threading

Igor Sysoev is at rambler-co.ru
Fri Apr 4 23:13:13 PST 2003


On Sat, 5 Apr 2003, Daniel Eischen wrote:

> > > Gah.  We're doing some crufty stuff here.  For starters, we're running
> > > userland on a LDT for %cs and %ds/es/ss/etc.  We really should be using a
> > > GDT slot for those.  Most of the other stuff there is for the a.out
> > > "lcall 7,0" instruction and for BSDI's version of the lcall stuff.

If %cs/ss/ds/es would be moved to GDT then I think it would be
helpfull to rearrange %cs and %ss so that %ss would be the next
selector after %cs, i.e. %ss == %cs + 8.  That order allows to use
Intel's sysenter/sysexit instructions. I'm not sure about AMD's ones.

> > > The i386_[gs]et_ldt() syscalls really should have a way of reporting what
> > > is available for use.
> > 
> > What we SHOULD be doing is setting an LDT entry to point to the 
> > mailbox (puts some constraints on the mailbox but..) of each upcall
> > and setting %gs to teh appropriate entry before returning to userspace.
> 
> Well, we can do it just fine from userland and are doing it
> right now.  The kernel doesn't really need to...  But, if
> you want to do that, let's think about the interface and
> see if it makes sense for all architectures.
> 
> If the kse_create() is going to do it, then we should probably
> pass in the size of the entry, or perhaps put the size in the
> kse mailbox with the mailbox address being the start address.
> That way we can put the kse mailbox in the (at the top) userland
> KSE structure and still be free to change the size.

Julian's suggestion would allow to support more than 8192 KSEs per
a proccess on x86 although such huge number of threads can be treated
as a bad design.  I think that %gs should contains LDT selector that
permanent per CPU but not per KSE mailbox. KSE mailbox should be pointed
by LDT descriptor that changed each time before returning to userspace.


Igor Sysoev
http://sysoev.ru/en/



More information about the freebsd-threads mailing list