CS485G Spring 2015 40
(a) Monolithic: many functions, all linked together.
(b) Other: object-oriented, layered, dynamically loaded modules
(c) Linux: Mostly monolithic, written in C (and some assembler),
but with some object-based data structures, layers for utilities
such as memory management, and dynamically loaded mod-
ules, mostly for device control.
6. The kernel code runs only when
(a) A process requests assistance via a system call.
(b) A process executes an invalid instruction.
(c) A device generates an interrupt indicating it needs service.
7. The kernel executes in a privileged mode that lets it execute any
instruction, access any memory location, access any device.
8. Processes execute in user mode, which limits the instructions, mem-
ory access, and device access.
44 Exception handling
1. Hardware exceptions are of two types:
(a) interrupts are caused asynchronously by devices; examples are
clock interrupts and device-completion interrupts. Some are
unrecoverable, such as power fail.
(b) traps are caused by faults during executing an instruction, such
as division by zero or attempt to access memory in an invalid
way. They are also intentionally caused by processes in order to
invoke a system call.
2. When an exception occurs:
(a) The CPU saves the current state (at least the PC, usually other
information as well such as the current processor state) in a
standard place (often on the stack).
(b) The CPU changes to privileged mode.
(c) The CPU jumps to a standard location (based on the particular
exception, typically through a jump table called an interrupt
vector). That location is in the kernel.
Komentáře k této Příručce