Process States in OS

Process :

A process is a program at the time of execution. A process is more than the program code. It includes the program counter, the process stack, and the contents of the process register, etc.

Process States :

When a process executes, it changes the state, generally, the state of process is determined by the current activity of the process.

process states

Each process may be in one of the following states :

  • New: The process is being created.
  • Running: The process is been executing.
  • Waiting: The process is waiting for some event to occurs.
  • Ready: The process is waiting to be assigned to a processor.
  • Terminate: The process has finished execution.

    The important thing is only one process can be running in any processor at any time. But many processes may be in ready and waiting states. The ready process is loaded into a “Ready Queue“.

    New → Ready: The operating system creates a process and prepares the process to be executed, then the operating system moved the process into “Ready Queue“.

    Ready → Running: When it is time to select a process to run. The operating system selects one of the jobs from the ready queue and moves the process from the ready state to the running state.

    Running → Terminated: When the execution of a process has completed, then the operating system terminates that process from running state.

    Running → Ready: When the time slot of the processor expired, then the operating system shifted the running process to the ready state.

    Running → Waiting: A process is put into the waiting state. If the process needs an event to occur or an I/O device. The operating system doesn’t provide the I/O device then the process moved to the waiting state by the operating state.

    Waiting → Ready: A process in the blocked state is moved to the ready state when the event for which it has been waiting occurs.