An operating system can have various modes of operation and these modes define standardised instructions for deciding what resources can be accessed, limit memory access and more in order to protect data and provide system security.
There are two types of modes, User Mode and Kernel Mode. A kernel mode is also known as supervisor mode.
User mode
It has restricted access to the resources. CPU has restrictions, therefore, it can have only access to limited instructions and memory. Utility applications such as text editor, media player are run in this mode.
When an application or program is executed, its initial state and operation mode are loaded on stack. At this point, CPU starts executing the program in this particular mode. Interrupts and traps are used to signal or flag the CPU to switch back to Kernel mode and do the essential tasks by storing the current state of the user program to the stack again. After completing it, CPU resumes the program from where it left.
Kernel Mode
It has full access to memory, I/O and other resources. In this, CPU can execute any instructions and have full access to underlying hardware. The core functionalities of the operating system always run in Kernel mode.
Having these authorities, processes using this mode have full rights to access resources, allowing them read/write to the storage media, enable and disable hardware and more. Difference between Kernel Mode and User Mode :
Basis | Kernel Mode | User Mode |
---|---|---|
Permission | Unrestricted and full permissions to access the system's hardware | Restricted and limited permissions to access the system's hardware |
Memory reference | It can reference to both the memory spaces | It can only reference to memory space that is dedicated to user mode |
Access | Only core functionality can be allowed to operate in this very mode | User applications can access this mode for a particular system and is allowed to operate in this particular mode |
System crash | Fatal and increases the complexity | Recoverable and can simply restart the session |
Also Known | Privileged mode or Supervisor mode | Restricted mode |
Key Differences:
- The mode in which there is an unconditional, unrestricted and full permission to access the system’s hardware by the current executing piece of code is known as the kernel mode. The mode in which there is no means of accessing the system’s hardware directly by the current piece of code is also known as the user mode.
- The kernel mode is a very powerful and impactful mode which means that it can refer to any memory block of the system and can also orders to execute an instruction to the CPU. The user mode is standardized and normal viewing mode which means that it cannot reference to any memory block or execute any information on its own as it requires some Application Protocol Interface (API) to do these tasks.
- The kernel mode is the most unrestricted and candid mode that a system can have which means that only the trustable sources can be allowed to operate in this very mode. The user mode is more like a generic mode that can have, which means that any user can access this mode for a particular system and is allowed to operate in this particular mode.
- As the kernel mode is very important and candid this means that if the system crashes in this mode then it could be very fatal and increases the complexity. As the user mode is quite general and user-friendly this means that even if the system crashes in this mode then it is not fatal at all and can simply restart the session.
- The kernel mode is very crucial to the system as well as the system programmer so everything that runs easily runs on your PC might not run here because its purpose is to employ hardware for a particular task. The user mode is user friendly space where all the general code will definitely execute.