Fast user Space Mutexes (aka Futexes)

Galen Sampson galen_sampson at yahoo.com
Tue Oct 21 09:42:58 PDT 2003


Hello All,

   I have been working on the port of lwkt_* kernel mechanisms to userland with
the help of Matt.  Currently threading works inside a single processes.  The
messaging primitives also work.  I have rudimentary support for a sysport as
discussed in the userapi so one can message the kernel via
lwkt_sendmsg(nanosleep_args); and have it execute the system call.  This is all
quite possibly going to change as more input is needed from Matt.  This is a
preliminary "HEADS UP" if you will.
   Currently the kernel does not know about threads in useland.  As previously
discussed on this list an rfork model will be used to create an m:n threading
package.  Each rfork (a process sharing its memory with another, but still two
or more processes as far as the kernel is concerned) will be used to provide
the "m" portion of the m:n system.  As such the kernel process scheduler will
be in charge of determining which rfork process and on which cpu.  The
userlevel threads operate on top of the rfork as the "n" portion of the system,
but the kernel does not know they exist.  In the spirit of keeping the userland
lwkt system the same as the kernel system and rforked process will get it's own
individual data set (struct globaldata), scheduler, idle loop, etc.  It will
determine which of its "n" threads to run when.  If this rfork runs out of
userland threads to run it will ipi (it won't be a litteral "inter-processor
interupt", but basically inter-process communication of some kind)message
another rfork asking for runnable threads.  Synchronization primitives are also
the same as the kernel, a token.  In this particular situation it does not seem
that futexes apply since the we use tokens, not mutexes, and the kernel does
not know about any of our userland threads.  Of course the work so far is quite
incomplete, and many ingenious people may find a way to use futexes
appropriately in our threading paradigm.

regards,
Galen

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com





More information about the Kernel mailing list