why user level threads need no system call?
I have read that the advantage of user-level threads is that they do not require kernel calls for switching. Does loading the registers (IP, SP) not require system call ? I programmed user-level threads in C using the fu开发者_如何学Gonctions - getcontext, setcontext ? Don't these function invoke system calls ?
(Most of) the registers visible to user-mode code can also be saved/restored in user-mode code.
Since a user-mode thread (at least normally) doesn't get switched preemptively, you don't normally need to save all the registers anyway. A typical implementation uses setjmp and longjmp to save/restore the necessary state. These typically don't involve any user/kernel mode switching.
精彩评论