Timer in CPU Protection
In multiple process system we want to make sure the multiple processes can be run so CPU is switched between different running processes. For example if multiple processes are run then CPU is given first to process1 for specific time period then 2 similarly to all the other processes.Checkout A Clock Display Time in Numbers
The technique of given CPU to the multiple processes is called CPU scheduling. As multiple processes are using CPU so we don’t want a process used CPU for an infinite time period so we need a timer which is loaded with a predetermined time and fix interval clock which periodically interrupt the CPU and when this clock interrupt , timer value is decremented by 1 and when timer value is 0 a special type of interrupt is generate which is called timer interrupt and Interrupt service routine (ISR) is execute which take the CPU from previous process and give it to the next process.
Dual Mode Operation in Hardware Protection
There are two CPU modes by which CPU can execute instructions. One is privileged or restricted mode also called kernel mode and other is non-privileged or unrestricted mode also called user mode. When the CPU is in Kernel mode, it has complete control on everything such as access of memory addresses, reading from a file etc so if any user program which is in the user mode wants to execute a system call i.e new process creation, I/O operations then it is done through system call in privileged mode. A system call is the request by the user program to the operating system’s kernel
For example at system boot time, the hardware starts in monitor mode. The operating system is then loaded, and starts user processes in user mode. Whenever a trap or interrupt occurs, the hardware switches from user mode to monitor mode. Thus, whenever the operating system gains control of the computer, it is in monitor mode. The system always switches to user mode (by setting the mode bit to 1) before passing control to user program.
The dual mode of operation provides us with the means for protecting the operating system from users can harm each other or can disturb the working of privileged mode. We accomplish this protection by designating some of the machine instructions that may cause harm as privileged instructions. The hardware allows privileged instructions to be executed only in monitor mode. If an attempt is made to execute a privileged instruction in user mode, the hardware does not execute the instruction, but rather treats the instruction as illegal and traps it to the operating system.
Timer in CPU Protection - Dual Mode Operation in Hardware Protection
Reviewed by MCH
on
February 14, 2016
Rating:
No comments: