Tag: Operating System Process

Process States in Operating System

Process States in Operating System-

 

Each process goes through different states in its life cycle-

 

 

1. New State-

 

  • A process is said to be in new state when a program present in the secondary memory is initiated for execution.

 

2. Ready State-

 

  • A process moves from new state to ready state after it is loaded into the main memory and is ready for execution.
  • In ready state, the process waits for its execution by the processor.
  • In multiprogramming environment, many processes may be present in the ready state.

 

3. Run State-

 

  • A process moves from ready state to run state after it is assigned the CPU for execution.

 

4. Terminate State-

 

  • A process moves from run state to terminate state after its execution is completed.
  • After entering the terminate state, context (PCB) of the process is deleted by the operating system.

 

5. Block Or Wait State-

 

  • A process moves from run state to block or wait state if it requires an I/O operation or some blocked resource during its execution.
  • After the I/O operation gets completed or resource becomes available, the process moves to the ready state.

 

6. Suspend Ready State-

 

  • A process moves from ready state to suspend ready state if a process with higher priority has to be executed but the main memory is full.
  • Moving a process with lower priority from ready state to suspend ready state creates a room for higher priority process in the ready state.
  • The process remains in the suspend ready state until the main memory becomes available.
  • When main memory becomes available, the process is brought back to the ready state.

 

6. Suspend Wait State-

 

  • A process moves from wait state to suspend wait state if a process with higher priority has to be executed but the main memory is full.
  • Moving a process with lower priority from wait state to suspend wait state creates a room for higher priority process in the ready state.
  • After the resource becomes available, the process is moved to the suspend ready state.
  • After main memory becomes available, the process is moved to the ready state.

 

Important Notes-

 

Note-01:

 

A process necessarily goes through minimum 4 states.

 

  • The minimum number of states through which a process compulsorily goes through is 4.
  • These states are new state, ready state, run state and terminate state.
  • However, if a process also requires the I/O operation, then minimum number of states is 5.

 

Note-02:

 

A single processor can execute only one process at a time.

 

  • A single processor can not more than one processes simultaneously.
  • If n processors are present in the system, then only n processes can be executed simultaneously.

 

Note-03:

 

StatePresent in Memory
New stateSecondary Memory
Ready stateMain Memory
Run stateMain Memory
Wait stateMain Memory
Suspend wait stateSecondary Memory
Suspend ready stateSecondary Memory
Terminate state

 

Note-04:

 

Moving a process from wait state to suspend wait state is a better alternative.

 

  • Consider a process with higher priority arrives and the main memory is full.
  • Then, there are two ways to make room for it.

 

These two ways are-

  1. Moving a process with lower priority from ready state to suspend ready state.
  2. Moving a process with lower priority from wait state to suspend wait state.

 

Out of these-

  • Moving a process from wait state to suspend wait state is a better alternative.
  • This is because the process is already waiting for some blocked resource.

 

To gain better understanding about Process States in Operating System,

Watch this Video Lecture

 

Next Article- Process Control Block | PCB

 

Get more notes and other study material of Operating System.

Watch video lectures by visiting our YouTube channel LearnVidFun.