Exceptional Control Flow Flashcards
fork()
creates new process, that is exact copy of parent process. fork() returns 0 in the child, and returns the pid of the child to the parent.
fork() returns twice.
Interrupts
interrupts occur asynchronously as a result of signals from IO devices that are external to the processor. they are not caused by a particular instruction.
return behavior: always returns to next instruction
Trap
intentional exceptions that are caused by executing an instruction. Traps provide an interface between user programs and the Kernel (in the form of system calls).
Examples of System calls
read (reading a file),
fork (creating a process),
execve (loading new program)
exit (terminating)
Faults
Fault result from error conditions that a handler might ne able to correct. When a fault occurs the processor transfers control to a handler that may or may not be able to recover from the fault. if recovery is possible return to faulting instruction. else abort.
Examples of Faults
page fault exception, Divide Error, General Protection Fault (seg-fault).
Aborts
unrecoverable fatal errors. Eg. hardware error. Aborts to not return control to the program, but terminate.
Def: Process
an instance of a running program
Process Abstractions
1) logical control flow, each process things it is only program running.
2) private address space
Process states
1) running
2) stopped, suspended and will not be scheduled until it get the signal todo so.
3) Terminated the process is stopped permanently. (terminated or returned from main, exited)
Reaping Child Process
The processor returns the childs exit status to the parent.