top of page
  • Alex Ricciardi

Understanding Process States in Operating Systems

This article describes the role of process states in Operating Systems, detailing how they manage resource allocation and processor time through transitions between Ready, Running, Waiting, and Terminated states.


Alexander S. Ricciardi

June 20th, 2023


 

Start Ready Wait Running Terminated

Processes and their states are fundamental components of an Operating System playing a role in resource management. Moreover, process states have a crucial part in how processor time and processor resources are allocated and distributed.


A process can be defined as: 

  • “A program in execution.

  • An instance of a program running on a computer.

  • The entity that can be assigned to and executed on a processor.

  • A unit of activity characterized by the execution of a sequence of instructions, a current state, and an associated set of system resources.” (Stallings, Chapter 3, 2018)


In the context of the discussion, a process can be defined as a set of instructions that need to be executed by a processor.


Secondly, a process state is the status of a process at a given time. They are four main processes in a Process Life Cycle:

  • Ready to be assigned to a processor. 

  • Running, a processor is executing the process.

  • Waiting, the process is idle waiting for resources.

  • Terminated, the process is removed from memory.


The first state that I will discuss in this post is the Running state. A process is in the Running state when it is being executed by a processor, and the process will be executed until one of the following events happens:

  • The process is completed. The process state will change from Running to Terminated. 

  • The process is preempted by the OS due to a higher priority process coming into the ready state. The process state will change from Running to Ready.

  • The process’s time slice has expired. The process state will change from Running to Ready.

  • The process requested an I/O operation. The process state will change from Running to Waiting.

  • The process is waiting for data from another process. The process state will change from Running to Waiting.

  • A system call is requested. If the system call was requested by the process, the process state will change from Running to Waiting, If the system call was requested by another process (multiprogramming and/or multiprocessor environments) from Running to Ready.

  • An exception happened, for example, the process is trying to open a nonexistent file. Depending on the exception the process state change from Running to Waiting or from Running to Terminated.


The second state that I will discuss in this post is the Waiting state also called the Blocked state. A process is in a Waiting state when it is waiting for some event to occur (like user input or disk access), or it's waiting for a resource to become available. The process is idle and not being executed.


The process will be in the Waiting state until one of the following events happens:

  • Completion of an I/O request. The process state will change from Waiting to Ready.

  • Receiving requested data (or signal) from another process. The process state will change from Waiting to Ready.

  • A requested resource is available. The process state will change from Waiting to Ready.


Furthermore, a process with a Waiting state status can only transition to a Ready state, in comparison a process in a Running state can transition to a Terminated, a Ready, or a Waiting state.


The following chart flow depicts the transitions between the four main states Running, Terminated, Waiting, and Ready state and the New state.


Figure 1

Process State

Process State

Note: From Operating System Concepts by Silberschatz et al. (2018)


In conclusion, processes and their state are fundamental components of an operating system used to manage resources, and process states play a crucial part in how processor time and processor resources are allocated and distributed. Additionally, there are four main states, which are Ready, Running, Waiting, and Terminated states. A process is in a Running state when is being run by a processor, and in a Waiting state when the process is waiting for resources or signals from another process. Furthermore, a process in a Waiting state can only transition to a Ready state, on the other hand, a process in a Running state can transition to a Terminated, a Ready, or a Waiting state. 


 

References:


Silberschatz, A., Galvin, P. B., & Gagne, G. (2018). Operating System Concepts [PDF]. Wiley. Retrieved from: https://os.ecci.ucr.ac.cr/slides/Abraham-Silberschatz-Operating-System-Concepts-10th-2018.pdf


Stallings, W. (2018). Operating Systems: Internals and design principles. Pearson.


Comments


Commenting has been turned off.
bottom of page