Unformatted text preview: r process. This is illustrated by the diagram in
User Monitor Set user mode Figure 2.4 The dual- mode operation of the CPU b) I/O Protection
A user process 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 5 refusing to relinquish the CPU. We can use various mechanisms to ensure that such
disruptions cannot take place in the system.
To prevent users from performing illegal I/O, we define all I/O instructions to be
privileged instructions. Thus 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.
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 from the interrupt vector. 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. Then, when a corresponding trap or interrupt
occurred, the hardware would switch to monitor mode and transfer control through the
modified interrupt vector table to a user program, causing it to gain control of the
computer in monitor mode. Hence we need all I/O instructions and instructions for
changing the contents of the system space in memory to be protected. A user process
could request a privileged operation by executing a system call such as read (for reading
a file). 6...
View Full Document
- Spring '12
- Operating Systems, real time systems