Section Two is concerned with traps, hardware interrupts and software interrupts.
Traps and hardware interrupts introduce sudden switches into the CPU’s normal instruction execution sequence. This provides a mechanism for handling special conditions which occur outside the CPU’s immediate control.
Use is made of this facility as part of another mechanism called the “system call” whereby a user program may execute a “trap” instruction to cause a trap deliberately and so obtain the operating system’s attention and assistance.
The software interrupt (or “signal” is a mechanism for communication between processes, particularly when there is “bad news”.
[Sheet 26; Chapter 10] defines a set of constants which are used in referencing the previous user mode register values when they are stored in the kernel stack.
[Sheets 26..28; Chapter 12] contains the “C” procedure “trap” which recognises and handles traps of various kinds.
[Sheet 29; Chapter 12] contains the declaration and initialisation of the array “sysent” which is used by “trap” to associate the appropriate kernel mode routine with each system call type.
[Sheets 30..33; Chapters 12, 13] contains various routines associated with system calls, including “exec” “exit” “wait” and “fork”.
[Sheets 34..36; Chapters 12, 13, 19] contains routines for “unlink”, “kill” and various other minor system calls.
[Sheets 37, 38; Chapter 11] contains “clock” which is the handler for clock interrupts, and which does much of the incidental housekeeping and basic accounting.
[Sheets 39..42; Chapter 13] contains the procedures which handle “signals” or “software interrupts” These provide facilities for interprocess communication and tracing.