Features of the Process State

  • A process can move from the running state to the waiting state if it needs to wait for a resource to become available.
  • A process can move from the waiting state to the ready state when the resource it was waiting for becomes available.
  • A process can move from the ready state to the running state when it is selected by the operating system for execution.
  • The scheduling algorithm used by the operating system determines which process is selected to execute from the ready state.
  • The operating system may also move a process from the running state to the ready state to allow other processes to execute.
  • A process can move from the running state to the terminated state when it completes its execution.
  • A process can move from the waiting state directly to the terminated state if it is aborted or killed by the operating system or another process.
  • A process can go through ready, running and waiting state any number of times in its lifecycle but new and terminated happens only once.
  • The process state includes information about the program counter, CPU registers, memory allocation, and other resources used by the process.
  • The operating system maintains a process control block (PCB) for each process, which contains information about the process state, priority, scheduling information, and other process-related data.
  • The process state diagram is used to represent the transitions between different states of a process and is an essential concept in process management in operating systems.


States of a Process in Operating Systems

A process has several stages that it passes through from beginning to end. There must be a minimum of five states. Even though during execution, the process could be in one of these states, the names of the states are not standardized. Each process goes through several stages throughout its life cycle.

Process States in Operating System

The states of a process are as follows: 

  • New (Create): In this step, the process is about to be created but not yet created. It is the program that is present in secondary memory that will be picked up by OS to create the process.
  • Ready: New -> Ready to run. After the creation of a process, the process enters the ready state i.e. the process is loaded into the main memory. The process here is ready to run and is waiting to get the CPU time for its execution. Processes that are ready for execution by the CPU are maintained in a queue called ready queue for ready processes.
  • Run: The process is chosen from the ready queue by the CPU for execution and the instructions within the process are executed by any one of the available CPU cores.
  • Blocked or Wait: Whenever the process requests access to I/O or needs input from the user or needs access to a critical region(the lock for which is already acquired) it enters the blocked or waits state. The process continues to wait in the main memory and does not require CPU. Once the I/O operation is completed the process goes to the ready state.
  • Terminated or Completed: Process is killed as well as PCB is deleted. The resources allocated to the process will be released or deallocated.
  • Suspend Ready: Process that was initially in the ready state but was swapped out of main memory(refer to Virtual Memory topic) and placed onto external storage by the scheduler is said to be in suspend ready state. The process will transition back to a ready state whenever the process is again brought onto the main memory.
  • Suspend wait or suspend blocked: Similar to suspend ready but uses the process which was performing I/O operation and lack of main memory caused them to move to secondary memory. When work is finished it may go to suspend ready.

 

CPU and I/O Bound Processes: If the process is intensive in terms of CPU operations, then it is called CPU bound process. Similarly, If the process is intensive in terms of I/O operations then it is called I/O bound process. 

How does a process move between different states in an operating system?
A process can move between different states in an operating system based on its execution status and resource availability. Here are some examples of how a process can move between different states:

  • New to ready: When a process is created, it is in a new state. It moves to the ready state when the operating system has allocated resources to it and it is ready to be executed.
  • Ready to running: When the CPU becomes available, the operating system selects a process from the ready queue depending on various scheduling algorithms and moves it to the running state.
  • Running to blocked: When a process needs to wait for an event to occur (I/O operation or system call), it moves to the blocked state. For example, if a process needs to wait for user input, it moves to the blocked state until the user provides the input.
  • Running to ready: When a running process is preempted by the operating system, it moves to the ready state. For example, if a higher-priority process becomes ready, the operating system may preempt the running process and move it to the ready state.
  • Blocked to ready: When the event a blocked process was waiting for occurs, the process moves to the ready state. For example, if a process was waiting for user input and the input is provided, it moves to the ready state.
  • Running to terminated: When a process completes its execution or is terminated by the operating system, it moves to the terminated state.

Similar Reads

Types of Schedulers

Long-term – performance:  Decides how many processes should be made to stay in the ready state. This decides the degree of multiprogramming. Once a decision is taken it lasts for a long time which also indicates that it runs infrequently. Hence it is called a long-term scheduler. Short-term – Context switching time: Short-term scheduler will decide which process is to be executed next and then it will call the dispatcher. A dispatcher is a software that moves the process from ready to run and vice versa. In other words, it is context switching. It runs frequently. Short-term scheduler is also called CPU scheduler. Medium-term – Swapping time: Suspension decision is taken by the medium-term scheduler. The medium-term scheduler is used for swapping which is moving the process from main memory to secondary and vice versa. The swapping is done to reduce degree of multiprogramming....

Features of the Process State

A process can move from the running state to the waiting state if it needs to wait for a resource to become available. A process can move from the waiting state to the ready state when the resource it was waiting for becomes available. A process can move from the ready state to the running state when it is selected by the operating system for execution. The scheduling algorithm used by the operating system determines which process is selected to execute from the ready state. The operating system may also move a process from the running state to the ready state to allow other processes to execute. A process can move from the running state to the terminated state when it completes its execution. A process can move from the waiting state directly to the terminated state if it is aborted or killed by the operating system or another process. A process can go through ready, running and waiting state any number of times in its lifecycle but new and terminated happens only once. The process state includes information about the program counter, CPU registers, memory allocation, and other resources used by the process. The operating system maintains a process control block (PCB) for each process, which contains information about the process state, priority, scheduling information, and other process-related data. The process state diagram is used to represent the transitions between different states of a process and is an essential concept in process management in operating systems....