Open ThomsonTang opened 7 years ago
When we run a program on a modern system, we are presented with the illusion that our program is the only one currently running in the system. Our program appears to have exclusive use of both the processor and the memory. The processor appears to execute the instructions in our program, one after the other, without interruption. Finally, the code and data of our program appear to be the only objects in the system’s memory. These illusions are provided to us by the notion of a process.
A process is an instance of a running program.
A logical flow whose execution overlaps in time with another flow is called a concurrent flow, and the two flows are said to run concurrently. The general phenomenon of multiple flows executing concurrently is know as concurrency. The notation of a process taking turns with other processes is also known as multitasking. Each time period that a process executes a portion of its flow is called a time slice. Thus, multitasking is also referred to as time slicing.
A process provides each program with its own private address space. This space is private in the sense that a byte of memory associated with a particular address in the space cannot in general be read or written by any other process.
Although the contents of the memory associated with each private address space is different in general, each such space has the same general organization.
Exception Control Flow
Control Flow
Altering the Control Flow
There are tow mechanisms for changing control flow, both react to changes in Program state:
But this is insufficient for a useful system, it’s difficult to react to changes in System state:
Ctrl-C
at the keyboardExceptional Control Flow
setjmp()
/longjmp()
Exceptions
Exception Handing
K
K
= index into exception tableClasses of Exceptions
Exception can be divided into four classes: interrupts, traps, faults, and aborts.
Asynchronous Exceptions (Interrupts)
Ctrl-C
at the keyboardCtrl-Alt-Delete
on a PCSynchronous Exceptions