Friday, 27 September 2013

Switching from user mode to kernel mode

Switching from user mode to kernel mode

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.
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?

No comments:

Post a Comment