a very occasional diary.




threads, contexts and doors.

Paul Turner gave a talk about new threading interface, designed by Google, at this year Linux Plumbers Conference:

The idea is, very roughly, to implement the ucontext interface with kernel support. This gives the benefits of kernel threads (e.g., SMP support), while retaining fast context switches of user threads. switchto_switch(tid) call hands off control to the specified thread without going through the kernel scheduler. This is like swapcontext(3), except that kernel stack pointer is switched too. Of course, there is still an overhead of the system call and return, but it is not as important as it used to be: the cost of normal context switch is dominated by the scheduler invocation (with all the associated locking), plus, things like TLB flushes drive the difference between user and kernel context switching further down.

I did something similar (but much more primitive) in 2001. The difference was that in that old implementation, one could switch context with a thread running in a different address space, so it was possible to make a "continuation call" to another process. This was done to implement Solaris doors RPC mechanism on Linux. Because this is an RPC mechanism, arguments have to be passed, so each context switch also performed a little dance to copy arguments between address spaces.


  1. I agree with a lot of the points you made in this article. If you are looking for the sewer cleaning wake forest, then visit Bizzy bee plumbing. I appreciate the work you have put into this and hope you continue writing on this subject.

  2. I found your blog on Google and read a few of your other posts. I just added you to my Google News Reader. You can also visit Boiler Repair for more The New Century Plumbing & Heating related information and knowledge, Keep up the great work Look forward to reading more from you in the future.


Follow by Email