What is a Process in Operating System and what are the different states of a Process?

In the Operating System, a Process is something that is currently under execution. So, an active program can be called a Process. For example, when you want to search something on web then you start a browser. So, this can be process. Another example of process can be starting your music player to listen to some cool music of your choice.

A Process has various attributes associated with it. Some of the attributes of a Process are:

  • Process Id: Every process will be given an id called Process Id to uniquely identify that process from the other processes.
  • Process state: Each and every process has some states associated with it at a particular instant of time. This is denoted by process state. It can be ready, waiting, running, etc.
  • CPU scheduling information: Each process is executed by using some process scheduling algorithms like FCSF, Round-Robin, SJF, etc.
  • I/O information: Each process needs some I/O devices for their execution. So, the information about device allocated and device need is crucial.

States of a Process

During the execution of a process, it undergoes a number of states. So, in this section of the blog, we will learn various states of a process during its lifecycle.

  • New State: This is the state when the process is just created. It is the first state of a process.
  • Ready State: After the creation of the process, when the process is ready for its execution then it goes in the ready state. In a ready state, the process is ready for its execution by the CPU but it is waiting for its turn to come. There can be more than one process in the ready state.
  • Ready Suspended State: There can be more than one process in the ready state but due to memory constraint, if the memory is full then some process from the ready state gets placed in the ready suspended state.
  • Running State: Amongst the process present in the ready state, the CPU chooses one process amongst them by using some CPU scheduling algorithm. The process will now be executed by the CPU and it is in the running state.
  • Waiting or Blocked State: During the execution of the process, the process might require some I/O operation like writing on file or some more priority process might come. In these situations, the running process will have to go into the waiting or blocked state and the other process will come for its execution. So, the process is waiting for something in the waiting state.
  • Waiting Suspended State: When the waiting queue of the system becomes full then some of the processes will be sent to the waiting suspended state.
  • Terminated State: After the complete execution of the process, the process comes into the terminated state and the information related to this process is deleted.

The following image will show the flow of a process from the new state to the terminated state.

In the above image, you can see that when a process is created then it goes into the new state. After the new state, it goes into the ready state. If the ready queue is full, then the process will be shifted to the ready suspended state. From the ready sate, the CPU will choose the process and the process will be executed by the CPU and will be in the running state. During the execution of the process, the process may need some I/O operation to perform. So, it has to go into the waiting state and if the waiting state is full then it will be sent to the waiting suspended state. From the waiting state, the process can go to the ready state after performing I/O operations. From the waiting suspended state, the process can go to waiting or ready suspended state. At last, after the complete execution of the process, the process will go to the terminated state and the information of the process will be deleted.

This is the whole life cycle of a process.

That's it for this blog. Hope you learned something new today.

Do share this blog with your friends to spread the knowledge. Visit our YouTube channel for more content. You can read more blogs from here .

Keep Learning :)

Team AfterAcademy!