There are two modes of operation in the operating system to make sure it works correctly. These are user mode and kernel mode.
A diagram that illustrates the transition from user mode to kernel mode and back again is as follows −
The following are the modes −
The system is in user mode when the operating system is running a user application such as handling a text editor. The transition from user mode to kernel mode occurs when the application requests the help of operating system or an interrupt or a system call occurs.
The mode bit is set to 1 in the user mode. It is changed from 1 to 0 when switching from user mode to kernel mode.
The system starts in kernel mode when it boots and after the operating system is loaded, it executes applications in user mode. There are some privileged instructions that can only be executed in kernel mode. These are interrupt instructions, input output management etc. If the privileged instructions are executed in user mode, it is illegal and a trap is generated.
The mode bit is set to 0 in the kernel mode. It is changed from 0 to 1 when switching from kernel mode to user mode.
The concept of modes of operation in operating system can be extended beyond the dual mode. This is known as the multimode system. In those cases the more than 1 bit is used by the CPU to set and handle the mode.
An example of the multimode system can be described by the systems that support virtualisation. These CPU’s have a separate mode that specifies when the virtual machine manager (VMM) and the virtualisation management software is in control of the system.
For these systems, the virtual mode has more privileges than user mode but less than kernel mode.