User Mode and Kernel Mode
Mode Bit
- A bit, called mode bit, is added to the hardware of the computer to indicate current mode.
- 0: kernel mode
- When a task is executed on behalf of the operating system
- 1: user mode
- When a task is executed on behalf of the user
Switch
- Whenever a trap or interrupt occurs, the hardware switches from user mode to kernel mode
- i.e., change mode bit to 0
- When a user application requests a service from the operating system (via a system call)
- It must transition from user to kernel mode to fulfill the request
- Privileged Instructions
- The hardware allow privileged instructions to be executed only in kernel mode.
- The instruction to switch to kernel mode is an example of a privileged instruction. Some other example include I/O control, timer management, and interrupt management.
No comments:
Post a Comment