从用户模式切换到内核模式 [英] Switching from user mode to kernel mode
问题描述
在我的操作系统类中,我被问到是否有特权从用户模式切换到内核模式.这不是特定于操作系统的.起初我以为是,但是好像是22个大问题.我提到了我的教科书:
In my operating systems class, I'm asked whether switching from user to kernel mode is privileged. This is not OS-specific. At first I thought yes, but it seems like a big Catch 22. I referred to my textbook:
硬件允许仅在以下位置执行特权指令 内核模式. ...
The hardware allows privileged instructions to be executed only in kernel mode. ...
切换到内核模式的指令是特权的示例 指示.
The instruction to switch to kernel mode is an example of a privileged instruction.
加涅,格雷格;亚伯拉罕·西尔伯斯查兹(Abraham Silberschatz)彼得·B·加尔文(2010年1月26日). 操作系统概念(第22页).威利高等教育Kindle版.
Gagne, Greg; Abraham Silberschatz; Peter B. Galvin (2010-01-26). Operating System Concepts (p. 22). Wiley Higher Ed. Kindle Edition.
所以我们从用户模式开始.要切换到内核模式,需要特权指令.特权指令必须在内核模式下完成,因此我们必须切换到内核模式才能启用切换到内核模式.
So we start in user mode. To switch to kernel mode requires a privileged instruction. A privileged instruction must be done in kernel mode, therefore we must switch to kernel mode to enable switching to kernel mode.
我认为系统不允许用户直接切换到内核模式,但是当用户试图执行另一条特权指令时,它是由内核完成的.正确吗?
I'm thinking the system does not allow a user to switch itself to kernel mode directly, but that it is done by the kernel when the user seeks to execute another privileged instruction. Is that correct?
推荐答案
这是第8版中引入的错字,并保留在第9版中.在第七版的第19页中,改为:
That is a typo introduced in the 8th edition and kept in the 9th. In the seventh edition, page 19, it says instead:
切换到用户模式的指令是特权的示例 指令."
"The instruction to switch to user mode is an example of a privileged instruction."
显然更有意义.
这篇关于从用户模式切换到内核模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!