User threads basic question
User threads basic question
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
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
Can you give any examples, for instance, what does Linux use? I think it looks simplier to do everything via the kernel..