|CS 321 Spring 2012 > Lecture Notes for Monday, January 30, 2012|
Note: Since we are following the text more closely now, lecture notes will be limited to short summaries, along with material that is not in the text.
A process is a program in execution. A program is just code; a process is active. A single program may correspond to more than one process.
Processes allow for support of concurrency, also called multitasking: logically (if not actually) performing multiple tasks at once. This is in contrast to parallelism, in which we physically perform multiple tasks at once: this requires hardware support.
The OS is responsible for process scheduling.
In *ix OSs, new processes are created using
This is supposed to copy all data of the parent process,
which can be slow.
vfork, a system call which does
not make the copy.
The idea is that the new process will do an
vfork call is unfortunately somewhat unsafe,
as modification of data between
execve results in undefined behavior.
A more modern solution is to use copy-on-write.
The parent’s data is not copied immediately.
Part of the implementation of the
is that the parent’s data is marked so that the
memory manager will
copy any data that is modified between a
and a subsequence
Typically, very little is modified, which makes this
technique very efficient indeed.
On the other hand, if data do get modified,
then copy-on-write means that program behavior is still correct.
a process is created using the
system call, discussed earlier.
This specifies the executable for the new process,
and so it is roughly equivalent to a fork-exec combination
under *ix OSs.
Processes can be terminated voluntarily or involuntarily, and due to an error or not. This means we have 4 different classes of methods for terminating processes. Examples of each are shown below.
|Involuntary||Killed by other process||Fatal error
E.g., segmentation fault due to unauthorized memory access
Introduction to Processes will be continued next time.