CMSC 412
|
NOTE 1
|
Feb 27, 1999
|
Some Basic Concepts about Processes
A process is the execution of a sequence of instructions in some context.
The context and sequence of instructions is specified by a program.
A computer system has both user processes and OS processes.
A user process is the execution of a user program.
A OS process is like a user process except that the program belongs
to the OS code and the CPU executes it in OS mode.
At any time, a process is either executing or waiting for an event.
The event can be an io completion, timer interrupt, external input, etc.
It can be communicated at a low level, i.e., as a hardware interrupt, or
at a higher level, i.e., as a "signal" from another process.
When a waiting process is to be restarted, there are two possiblities:
-
The process is to be resumed in the state in which it was last interrupted.
In this case, the "old state" of the process, i.e., the state just prior
to being interrupted, needs to be saved in a OS data structure,
typically called the PCB (process control block) of the process.
The PCB can be in OS memory or in disk.
We refer to such a process as a "pcb process".
-
The process is to be restarted from a fixed (hence also initial) state
that is stored in "read-only" memory or disk blocks. In this case, the
old state of the process need not be saved, so there is no need to have
a PCB for this process.
We refer to such a process as a "nonpcb process".
Note: "pcb process" and "nonpcb process" are not standard terminology.
It is not possible for a computer system to have pcb processes and no
nonpcb process as long as the OS and user processes share a cpu. This is
because the execution of the code that switches the cpu from one pcb process
to another pcb process is itself a nonPCB process.
A pcb process is in one of the following "states":
-
New:
process has been created but has not yet acquired any resources
(other than storage on disk).
-
Ready:
process is waiting only for the cpu, i.e., it has all other resources
(memory, disk space, entries in OS tables, etc.).
-
Running:
process is executing, i.e., the cpu is executing instructions of the
process's program. The process has all the resources it needs.
This is also the stable time duration when the processor when the pcb
of the process is "stale", i.e., does not accurately reflect the current
state of the process.
-
Waiting:
process is waiting for an event, i.e., an io completion, a IPC from
another process, etc. The process may or may not have memory.
-
Terminated:
process has finished execution and it is "waiting" for the OS to recover
its resources.