Unformatted text preview: O devices. If a user process tries to execute a privileged
instruction, a trap should be generated and process should be terminated prematurely. At
the same time, a piece of operating system code should be allowed to execute privileged
instructions. In order for the CPU to be able to differentiate between a user process and
an operating system code, we 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, is added to the hardware of the computer to indicate the current
mode: monitor mode (0) or user mode (1). With the mode bit we are able to distinguish
between a task that is executed on behalf of the operating system and one that is executed
on behalf of the user.
The concept of privileged instructions also provides us with the means for the user to
interact with the operating system by asking it to perform some designated tasks that only
the operating system should do. A user process can request the operating system to
perform such tasks for it by executing a system call. Whenever a system call is made or
an interrupt, trap, or signal is generated, CPU mode is switched to system mode before
the relevant kernel code executes. The CPU mode is switched back to user mode before
the control is transferred back to the use...
View Full Document
This document was uploaded on 10/17/2012.
- Spring '12