In any Operating System, it is necessary to have Dual Mode Operation to ensure protection and security of the System from unauthorized or errant users . This Dual Mode separates the User Mode from the System Mode or Kernel Mode.
What are Privileged Instructions?
The Instructions that can run only in Kernel Mode are called Privileged Instructions .
Privileged Instructions possess the following characteristics :
(i) If any attempt is made to execute a Privileged Instruction in User Mode, then it will not be executed and treated as an illegal instruction. The Hardware traps it to the Operating System.
(ii) Before transferring the control to any User Program, it is the responsibility of the Operating System to ensure that the Timer is set to interrupt. Thus, if the timer interrupts then the Operating System regains the control.
Thus, any instruction which can modify the contents of the Timer is a Privileged Instruction.
(iii) Privileged Instructions are used by the Operating System in order to achieve correct operation.
(iv) Various examples of Privileged Instructions include:
- I/O instructions and Halt instructions
- Turn off all Interrupts
- Set the Timer
- Context Switching
- Clear the Memory or Remove a process from the Memory
- Modify entries in Device-status table
What are Non-Privileged Instructions?
The Instructions that can run only in User Mode are called Non-Privileged Instructions .
Various examples of Non-Privileged Instructions include:
- Reading the status of Processor
- Reading the System Time
- Generate any Trap Instruction
- Sending the final prinout of Printer
Also, it is important to note that in order to change the mode from Privileged to Non-Privileged, we require a Non-privileged Instruction that does not generate any interrupt.
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 3-address instruction and 2-address instructions
- Difference between 2-address instruction and 1-address instructions
- Traps and System Calls in Operating System (OS)
- Machine Control Instructions in Microprocessor
- ROTATE Instructions in 8085
- COMPARE Instructions in 8085
- Various Instructions for five stage Pipeline
- What is MIPS(Million of Instructions Per Second)?
- System Protection in Operating System
- User View Vs Hardware View Vs System View of Operating System
- System Programs in Operating System
- File System Implementation in Operating System
- Xv6 Operating System -adding a new system call
- Threads and its types in Operating System
- Logical and Physical Address in Operating System
- Booting and Dual Booting of Operating System
- Difference between Operating System and Kernel
- Difference between Application Software and Operating System
- Difference between UNIX and Windows Operating System
- Process Schedulers in Operating System
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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 : VaibhavRai3