Explain various process states with diagram.
1 Answer

There are different states of a process as it executes. The state of a process is determined based on the current activity of the process.

  1. New: The process is being created.
  2. Running: The program instructions are being executed.
  3. Waiting: The process is waiting for some event to occur (such as an I/O completion or reception of a signal.
  4. Ready: The process is waiting in the ready queue to be assigned to a processor.
  5. Terminated: The process has finished execution.

It is important to realize that only one process can be in running state on any processor at any instant. Many processes may be ready and waiting, however.

Process state Diagram

The process is first admitted into the ready queue and stays there if the processor is busy. If the processor is idle, as soon as the process is admitted into the ready queue, it enters the processor immediately. The process in the CPU is said to be in a running state.

There are two scenarios where the process moves from the running state to the waiting state:

  1. The process is in need of any input goes back to the waiting state and waits for the input
  2. The process wants to access any output device such as a printer but the printer is busy with some other process then the process goes from running state to the waiting state.

As soon as the input/output or event is completed the process moves from the waiting state to the ready state and the sequence repeats.

If the process is taking time to complete its execution in the running state, then an interruption is called and the process is moved back to the ready queue to allow other processes to perform their tasks.

Please log in to add an answer.