DragonFly users List (threaded) for 2007-01
DragonFly BSD
DragonFly users List (threaded) for 2007-01
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: Request for swapcontext and getcontext to be ported to our libc


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 12 Jan 2007 19:06:19 -0800 (PST)

    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



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]