For instance, only the OS should
be allowed to change the contents of the base and limit memory protection registers. Only the OS should
determine which print request goes to the printer at any particular time.
The solution was a hardware ???mode??? switch to provide a ???user mode??? context and a ???privileged mode???
context. (Other words for privileged mode include system mode, monitor mode, and kernel mode.) Certain
instructions, such as loading the base and limit registers, and all I/O instructions, became ???privileged instructions.???
Privileged instructions can only be executed when the computer is in privileged mode.
When the computer boots up, the hardware sets the computer to privileged mode and the operating system
begins executing. As soon as the OS starts a user program executing, the OS sets the mode to user mode.
CHAP. 6] OPERATING SYSTEMS 97
Any attempt by the user program to execute a privileged instruction is trapped by the hardware as an error, and
causes a special interrupt to occur. When any interrupt occurs, the OS regains control and the mode switches
back to privileged mode. In the case of the errant user program, the OS issues an error message, terminates the
faulting program, and resumes computing with another process.
Pages:
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263