What is a process?
A process is a program in execution.
A process is a unit of work in a system.
Many processes can execute concurrently.
More specifically, a
squential process consists of:
- program code
- temporary data (on stack)
- global variables
- program counter
Note: Many processes may be associated with a single program.
Process State
States of a sequential process:
- New: starting up
- Running: instructions being executed
- Waiting: waiting for an event such as I/O
- Ready: Waiting to be assigned to a processor
- Halted: finished
invalid transitions
On a single processor system, only one process may be running at any time.
Process Control Block
The OS keeps track of processes via a process control block for each process.
The process control block may contain the following:
- Process state: one of the above states
- Program Counter: PC
- CPU registers: values of all necessary registers and condition codes
necessary to restart the program when it enters the running state.
- CPU scheduling information: priority information
- Memory management information: limit registers, page table addresses, etc.
- Accounting information: CPU time used so far, etc.
- I/O status information: outstanding I/O requests, allocated I/O devices,
open files, etc.
In UNIX a process can create another process using
fork.
The new process (the child) consists of a copy of the address space of the
creating process (the parent).
Both processes continue execution at the instruction after the fork.
The fork returns 0 to the child and non-zero (the PID) to the parent.
after fork
Next Notes
Back to CS 3733 Notes Table of Contents