Today
Exceptional Control Flow
Processes
1
Control Flow
Processors do only one thing:
From startup to shutdown, a CPU simply reads and executes
(interprets) a sequence of instructions, one at a time
This sequence is the CPU’s control flow (or flow of control )
Physical control flow
inst
1
inst
Time 2
inst
3
…
inst
n
2
Altering the Control Flow
Up to now: two mechanisms for changing control flow:
Jumps and branches
Call and return
Both react to changes in program state
React to changes in system state
data arrives from a disk or a network adapter
instruction divides by zero
user hits Ctrl-C at the keyboard
System timer expires
System needs mechanisms for “exceptional control flow” (ECF)
3
Exceptional Control Flow
Exists at all levels of a computer syste
Low level mechanisms
Exceptions
change in control flow in response to a system event
(i.e., change in system state)
Combination of hardware and OS software
Higher level echanisms
Process context switch
Signals
Nonlocal jumps: setjmp() / longjmp()
Implemented by either:
OS software (context switch and signals)
C language runtime library (n