Request for swapcontext and getcontext to be ported to our libc
Matthew Dillon
dillon at apollo.backplane.com
Fri Jan 12 19:15:58 PST 2007
Ok, well, I'll bring up a counterpoint - one that argues for it to
remain in userland.
When I examine the FreeBSD code, the ONLY thing the kernel does that
one needs to be in kernel mode for is setting the signal mask. That's
it. Everything else can be done in userland.
So the question becomes, is it possible to have a threaded system
where you can set the signal mask during a context switch and NOT
have to switch into the kernel?
The answer is: yes, it is possible. There is no reason why the
signal mask (and signal pending bitmap) couldn't be stored in user
memory, allowing the userland threading system to swap out the mask
without entering the kernel.
It would require having a system call that allows the userland threading
system to specify the user address where the signal mask resides, but
it could be done and it would not be difficult.
So I think there is a very good argument for making the current release
implementation do these calls in libc and not as system calls, and
initially have libc just get the signal mask with a system call, then
at some later date add the feature sthat allow the userland context
routines to run fully without having to make any system calls at all.
-Matt
More information about the Users
mailing list