tech-userlevel archive

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

Re: getcontext()/setcontext()/makecontext() reliability?



In article <20120504000717.GA20070%pixotech.com@localhost>,
David Young  <dyoung%pobox.com@localhost> wrote:
>On Thu, May 03, 2012 at 07:35:41PM -0400, Matthew Mondor wrote:
>> On Thu, 3 May 2012 12:59:45 -0500
>> David Young <dyoung%pobox.com@localhost> wrote:
>> 
>> > Are getcontext()/setcontext()/makecontext() known to work reliably on
>> > NetBSD?  It looks to me like they are used in NetBSD/usermode and in
>> > puffs, and there are tests exercising them, so I hoep that the answer is
>> > "yes!"
>> 
>> I can't confirm that it's still the case, but there's a CAVEATS section:
>> 
>> CAVEATS
>>      Due to limitations in the current pthread implementation, makecontext
>>      should not be used in programs which link against the pthread(3) library
>>      (whether threads are used or not).
>
>Right.  It's also deprecated by POSIX in favor of pthread(3).
>
>I'm looking into getcontext()/setcontext() because I think that its
>overhead may be way less than POSIX threads for an I/O server with
>potentially hundreds or thousands of active sessions.  Not so?
>
>In NetBSD, switching POSIX threads require, I thought, a user-kernel
>round trip.  I figure that's the costly part.

You realize {g,s}etcontext are system calls too, and they are not like the
old setjmp/longjmp that most of the time were implemented in userland?

christos



Home | Main Index | Thread Index | Old Index