开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜