User Mode vs Kernel Mode - aryanjoshi0823/5143-Operating-System GitHub Wiki
There are two modes of operation in an operating system:
- User Mode: Used for running user applications.
- Kernel Mode: Used for executing operating system-level tasks.
These modes are determined by a mode bit:
1
for user mode.0
for kernel mode.
Transitions between these modes occur during system calls or interrupts.
User Mode
The system operates in user mode when executing user applications like text editors or web browsers. A transition to kernel mode happens when:
-
Key Characteristics:
- The mode bit is set to
1
. - Restricted access to hardware and system resources.
- Errors in user mode affect only the application, not the entire system.
- The mode bit is set to
-
Example: A user application requesting to save a file invokes a system call, switching to kernel mode.
Kernel Mode
Kernel mode is required for executing operating system services and privileged instructions like hardware management.
-
Key Characteristics:
- The mode bit is set to
0
. - Full access to system hardware and resources.
- Can execute privileged instructions like interrupt handling and I/O management.
- Errors in kernel mode can affect the entire system.
- The mode bit is set to
-
Example: Tasks like managing process scheduling and device drivers occur in kernel mode.