Page 1 of 1

User threads basic question

Posted: Tue Mar 10, 2009 10:35 am
by mangaluve
I just wonder about user threads. Suppose I run a user application and want threads. Should the context switches within my application go through the kernel (so basically I just have one kind of thread almost, it really doesn't matter to the kernel), or should the application handle it by itself?

Re: User threads basic question

Posted: Tue Mar 10, 2009 1:40 pm
by skyking
Both could work, but your kernel has to have some supporting features for the options to be usable. For the first options your kernel must of course support multitasking. The second need the possibility to handle blocking syscalls (or equivalent) properly - if you do the thread switching in the process it self it can't really be useful if the whole process is blocked by fx a file read.

Re: User threads basic question

Posted: Tue Mar 10, 2009 4:55 pm
by mangaluve
Can you give any examples, for instance, what does Linux use? I think it looks simplier to do everything via the kernel..