[M3devel] User-level threading

Tony Hosking hosking at cs.purdue.edu
Tue Jul 3 18:42:16 CEST 2007


I have a question that may influence the direction we take with user- 
level threading support.  Currently, user-level threading is broken  
on platforms that implement secure setjmp/longjmp via encryption  
since hacking the jump buffers the way we currently do for user-level  
threading triggers longjmp errors.  A better alternative is to use  
makecontext/getcontext/setcontext on platforms that support it.  For  
example, I know of the following situation for the targets I track:

Target		System (pthreads) threads	User (setjmp/longjmp) threads	User  
(getcontext/setcontext) threads

LINUXLIBC6	YES				NO				unimplemented
SOLgnu		YES				unimplemented			YES (but not using makecontext)
PPC_DARWIN	YES				NO				no getcontext/setcontext
I386_DARWIN	YES				NO				no getcontext/setcontext
FreeBSD		NO				YES				unimplemented

Ideally, we would implement all user-level threading using  
makecontext and friends, but my question is how many of our user- 
level threading targets actually support that API?  One strategy  
would be to re-implement user-level threading using makecontext,  
etc., but fake up makecontext support, etc., on those targets that  
don't have it.

I would hate to lose the user-level thread support just because it  
makes sense in some situations (e.g., embedded, uni-processor).




More information about the M3devel mailing list