- As a process executes, it changes state. The state of a process is defined in part by the current activity of that process.
- Each process may be in one of the following states:
- New. The process is being created.
- Running. Instructions are being executed.
- Waiting. The process is waiting for some event to occur (such as an I/O completion or reception of a signal).
- Ready. The process is waiting to be assigned to a processor.
- Terminated. The process has finished execution.
- The state diagram corresponding to these states is presented in Fig. 3.3.
Diagram of process state.
- Using the process model, it becomes much easier to think about what is going on inside the system.
- Some of the processes run programs that carry out commands typed in by a user.
- Other processes are part of the system and handle tasks such as carrying out requests for file services or managing the details of running a disk or a tape drive.
- When a disk interrupt occurs, the system makes a decision to stop running the current process and run the disk process, which was blocked waiting for that interrupt.
- Instead of thinking about interrupts, we can think about user processes, disk processes, terminal processes, and so on, which block when they are waiting for something to happen. When the disk has been read or the character typed, the process waiting for it is unblocked and is eligible to run again. This view gives rise to the model shown in Fig. 3.4.
The lowest layer of a process-structured OS handles interrupts and scheduling. Above that layer are sequential processes.