1
1
Exceptions, Interrupts & Traps
Operating System Hebrew University Spring 2007
2
Memory Hierarchy
- Main Memory - located on chips inside the system unit.
- The program instructions and the processes data are kept in
main memory during computer works.
- External Memory - disk. Information stored on a disk is not
deleted when the computer turned off.
- The main memory has less storage capacity than the hard disk.
The hard disk can write and read information to and from the main memory. The access speed of main memory is much faster than a hard disk.
- Programs are stored on the disk until they are loaded into
memory, and then use the disk as both the source and destination of the information for their processing.
3
Typical Memory Hierarchy
4
Definitions…
- When the CPU is in kernel mode, it is assumed to be
executing trusted software, and thus it can execute any instructions and reference any memory addresses.
- The kernel is the core of the operating system and it
has complete control over everything that occurs in the system. The kernel is trusted software, but all
- ther programs are considered untrusted software.
- A system call is a request to the kernel in a Unix-like
- perating system by an active process for a service
performed by the kernel.
5
More Definitions…
- A process is an executing instance of a program. An
active process is a process that is currently advancing in the CPU (while other processes are waiting in memory for their turns to use the CPU).
- Input/output (I/O) is any program, operation or device
that transfers data to or from the CPU and to or from a peripheral device (such as disk drives, keyboards, mice and printers).
- Processes in kernel mode can be interrupted by an
interrupt or an exception.
6
More Definitions…
- An interrupt is a signal to the operating system
indicating that an event has occurred, and it results in changes in the sequence of instructions that is executed by the CPU.
- In the case of a hardware interrupt, the signal originates
from a hardware device such as a keyboard (i.e., when a user presses a key), mouse or system clock (used to coordinate the computer's activities).
- A software interrupt is an interrupt that originates in
software, usually triggered by a program in user mode.
- All processes initially execute in user mode, and they