What is Two state process 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 the dispatcher allows P2 to execute on the 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.