Low level control flow: change in control flow because of a change in a system event. These control flow mechanisms exist at all levels of a computer system. These are combination of hardware and OS software.

Higher Level Mechanism: process context switch, signals, nonlocal jumps, try/exception blocks

Exceptions

An exception is the transfer of control to the OS in response to some event, i.e. change in CPU state

Interupt Vectors

Each event has a unique exception number where K is the value of the exception. K then is indexed in a jump table. where it points to a function to handle a specific exception. Hanlder K occurs each time exception K occurs.

Asynchronous exceptions

These are exceptions we manually do, like hit the reset button

Example: hitting ctl-c (SIGINT signal_handler)

press ctl-alt-delete

Synchronous Exceptions

Traps, faults, aborts

Traps - unintentional but possibly recoverable: such as page faults, protection faults

aborts: unintentional, but recoverable, aborts current program

Zombies

Half alive, half dead; when a zombie process terminates it still consumes resources

reaping: the parent process is given exit status information

Reaping is done by parent on terminated child

if parent doesn't reap: then it is reaped by the init process, only for long-running processes we need to reap

Wait

Synchronizing with children

Wait suspends its current process until one of its children terminates

return value is the pid of the child process that terminated