• Tutorials
  • DSA
  • Data Science
  • Web Tech
  • Courses
June 07, 2022 |33.1K Views

Process States in Operating System

  Share   Like
Description
Discussion

In this video, we have covered process states in the operating system. We have discussed what is process in detail & the different states of a process.

A process is a program in execution, the program resides in secondary memory and is a static entity, whereas when the same program gets executed it comes to the main memory for execution and is known as a process. While the process is in execution or in main memory it can be in various states.

The states of a process are:
1) New
2) Ready
3) Run
4) Waiting
5) Terminated
6) Suspend Ready
7) Suspend Wait

1) New State: It is the first state in the lifecycle of a process. In this state, the process has not been created yet, but it is about to be created. The program is present in the Secondary Memory at this point. The OS selects this program and creates it as a process. New State is also known as the Create State. A process in the New State is switched to the Ready State by the Long-Term Scheduler.

2) Ready State: Once the process is created, it switches from New State to the Ready State. In this state, the process has been loaded into the Main Memory. The process is waiting to execute on the CPU. The OS maintains a Ready Queue for all the processes in the Ready State. All the processes which are ready to execute on the CPU, but are waiting for their turn, are present in the Ready Queue. A process may enter the Ready State multiple times during its lifecycle.

3) Run State: In this state, the process is running on the CPU. The CPU executes the instructions present in the process. Any of the available CPU cores are assigned to the process during this state. Out of all the processes present in the Ready State, one process is selected by the Short-Term Scheduler. The selected process is then switched to the Run State by the Dispatcher.

4) Wait State: A process enters the Wait State due to any of the following reasons:
- It needs to perform an I/O operation.
- It needs to execute in its critical section, after acquiring the lock.
- It needs input from the user.
The process present in the Wait State remains in Main Memory (Wait Queue). On completion, the process switches to the Ready State. The Wait State is also known as Blocked State.

5) Terminated State: The process enters the Terminated State due to one of the reasons:
- It has completed its execution and ended normally.
- It has been terminated by the OS.
In this state, the Process Control Block is also deleted. The Terminated State is also known as the Completed State.

6) Suspend Ready State: When a process present in the Ready State, is removed from the Main Memory (Ready Queue) and placed in the Secondary Storage, the process is said to be in Suspend Ready State.
From this state, the process will be moved to the Main Memory (Ready Queue) and its state will be changed to the Ready State. The swapping of a process between Main Memory and Secondary Memory is performed by the Medium-Term Scheduler.

7) Suspend Wait State: When a process present in the Wait State, is removed from the Main Memory (Wait Queue) and placed in the Secondary Storage, then the process is said to be in the Suspend Wait State. This transition is performed due to lack of available space in the Main Memory. This state is also known as Suspend Blocked state. A process present in Suspend Wait State is switched to Suspend Ready State when it finishes its I/O operation.


Process states in OS: https://www.geeksforgeeks.org/states-of-a-process-in-operating-systems/