Two state model
In this model, we consider two main states of the process. These two states are:
State 1: Process is Running on CPU
State 2: Process is Not Running on CPU
New: First of all, when a new process is created, then it is in Not Running State. Suppose a new process P2 is created then P2 is in NOT Running State.
CPU: When CPU becomes free, Dispatcher gives control of the CPU to P2 that is in NOT Running state and waiting in a queue.
Dispatcher: Dispatcher is a program that gives control of the CPU to the process selected by the CPU scheduler. Suppose dispatcher allow P2 to execute on CPU.
Running: When dispatcher allows P2 to execute on CPU then P2 starts its execution. Here we can say that P2 is in running state.
Now, if any process with high priority wants to execute on CPU, Suppose P3 with high priority, then P2 should be the pause or we can say that P2 will be in waiting state and P3 will be in running state.
Now, when P3 terminates then P2 again allows the dispatcher to execute on CPU.
Five state model
Fig: Five States Process Model
- New: A process that has just been created but has not yet been admitted to the pool of executable processes by the OS.
- Ready: Process that is prepared to execute when given the That is, they are not waiting on anything except the CPU availability.
- Running: the process that is currently being executed.
- Blocked: A process that cannot execute until some event occurs, such as the completion of an I/O operation.
- Exit: A process that has been released from the pool of executable processes by the OS, either because it is halted or because it is aborted for some reason A process that has been released by OS either after normal termination or after abnormal termination (error).