模式切换是否发生从用户线程切换到内核线程?

Is mode switch occur switching from user thread to kernel thread?

我对 user/kernel 线程和 mode/context 开关感到困惑(平台:Linux)
我有两个相关的问题。

(1)下面这句话对吗?

If I make a system call, then mode switch (user mode to kernel mode) will occur and eventually switching from user thread to kernel thread happens.

由于系统调用只能在内核线程中执行,所以我认为模式切换必须发生在从用户线程到内核线程的切换。

(2) 那么,我们所说的模式切换开销就是用户线程到内核线程的切换开销?会有哪些开销?


据我所知,
1) 上下文切换是 CPU 从一个进程或线程切换到另一个进程或线程,并且只发生在内核模式下。
2) 调用模式切换(而不是上下文切换)的原因是当前正在执行的进程在模式切换期间不会改变。
3)进程上下文切换比Thread上下文切换成本更高。


(1) Is the below sentence right?

If I make a system call, then mode switch (user mode to kernel mode) will occur and eventually switching from user thread to kernel thread happens.

(2) Then, what we call the overhead of mode switching is that switching overhead of user thread to kernel thread? What kinds of overhead will there be?

保存寄存器,改变段选择器等。 Good answer这个问题

What is big difference between mode switch (user thread to kernel thread) and thread context switch (kernel thread to kernel thread)?

我认为在切换内核线程到内核线程的情况下,段选择器是相同的,也许一些寄存器也是如此。它取决于体系结构