What is Hardware Protection – Os notes

Hardware protection
2.08.eps

I/O Protection :-

What is Hardware Protection – Os notes

I/O Protection :-

In this paragraph, A user program may disrupt the normal operation of the system by issuing illegal I/O instructions, by accessing memory locations within the operating system itself, or by refusing to relinquish the CPU.

We can use various mechanisms to ensure that such disruptions cannot take place in the system. moreover, To prevent users from performing illegal I/O, we define all I/O instructions to be privileged instructions.

In conclusion, users cannot issue I/O instructions directly; they must do it through the operating system. For I/O protection to be complete, we must be sure that a user program can never gain control of the computer in monitor mode. If it could, I/O protection could be compromised.

For instance, Consider a computer executing in user mode. It will switch to monitor mode whenever an interrupt or trap occurs, jumping to the address determined from the interrupt vector.

Moreover, If a user program, as part of its execution, stores a new address in the interrupt vector, this new address could overwrite the previous address with an address in the user program. After that, when a corresponding trap or interrupt occurred, the hardware would switch to monitor mode, and would transfer control through the (modified) interrupt vector to the user program.

memeory protection

Memory Protection :-

To ensure correct operation, we must protect the interrupt vector from modification by a user program. In addition, we must also protect the interrupt-service routines in the operating system from modification.

Even if the user did not gain unauthorized control of the computer,

modifying the interrupt service routines would probably disrupt the proper operation of the computer system and of its spooling and buffering.

We see then that we must provide memory protection at least for the interrupt vector and the interrupt-service routines of the operating system.

In general, we want to protect the operating system from access by user programs, and, in addition, to protect user programs from one another.

In other words, This protection must be provided by the hardware. To separate each program’s memory space,

we need the ability to determine the range of legal addresses that the program may access, and to protect the memory outside that space. We can provide this protection by using two registers, usually a base and a limit.

Dual-mode operation

Dual-mode operation:-

To ensure proper operation, we must protect the operating system and all other programs and their data from any malfunctioning program.

Firstly, For any shared resource needs protection. The approach taken by many operating systems provides hardware support that allows us to differentiate among various modes of execution.

 SecondlyWe need two separate modes of operation: user mode and monitor mode (also called supervisor mode, system mode, or privileged mode).

A bit, called the mode bit, adds to the hardware of the computer to indicate the current mode: monitor (0) or user (1).

With the mode bit, we are able to distinguish between a task which executes on behalf of the operating system,

and one which executes on behalf of the user.

Thirdly, and most importantly, 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. In short, 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 a user program.

In conclusion, The hardware allows privileged instructions which is going to execute 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.

cpu protection

CPU protection :

In addition to protect I/O and memory, we must ensure that the operating system maintains control. We must prevent a user program from getting stuck in an infinite loop or not calling system services,

and never returning control to the operating system. To accomplish this goal, we can use a timer. To interrupt the computer after a specified period A timer can set. The period may be fixed or variable.

A variable timer generally implements by a fixed-rate clock and a counter. The operating system sets the counter. Every time the clock ticks, the counter decremented. When the counter reaches 0, an interrupt occurs.

Therefore, these are all about of What is Hardware Protection – Os notes.

If you want to download other previous year paper click to the link :https://www.soluversity.in/category/previous-paper

Lastly, and most importantly, for more information ,please write us :soluversity @gmail.com

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *