An error in one program can adversely affect many processes, it might modify data of another program, or also can affect the operating system. For example, if a process stuck in infinite loop then this infinite loop could affect correct operation of other processes. So to ensure the proper execution of the operating system, there are two modes of operation:
User mode –
When the computer system run user applications like creating a text document or using any application program, then the system is in the user mode. When the user application requests for a service from the operating system or an interrupt occurs or system call, then there will be a transition from user to kernel mode to fulfill the requests.
Note: To switch from kernel mode to user mode, mode bit should be 1.
Given below image describes what happen when an interrupt occurs:
Kernel Mode –
When the system boots, hardware starts in kernel mode and when operating system is loaded, it start user application in user mode. To provide protection to the hardware, we have privileged instructions which execute only in kernel mode. If user attempt to run privileged instruction in user mode then it will treat instruction as illegal and traps to OS. Some of the privileged instructions are:
- Handling Interrupts
- To switch from user mode to kernel mode.
- Input-Output management.
Note: To switch from user mode to kernel mode mode bit should be 0.
Read next – User Level thread Vs Kernel Level thread
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- Difference between Register Mode and Register Indirect Mode
- Difference between Implied addressing mode and Immediate addressing mode
- Difference between Relative Addressing Mode and Direct Addressing Mode
- Self Dual functions in Digital Logic
- Booting and Dual Booting of Operating System
- I/O Interface (Interrupt and DMA Mode)
- Mathematics | Set Operations (Set theory)
- Complexity of different operations in Binary tree, Binary Search Tree and AVL tree
- Different Operations on Matrices
- Read and Write operations in Memory
- Functionally Complete Operations
- Basic Laws for Various Arithmetic Operations
- Arithmetic Operations of Binary Numbers
- Operations on Processes
- Set Theory Operations in Relational Algebra
- Arithmetic Micro-operations in Registers
- Transforming of I/O Requests to Hardware Operations
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : midhunxda