What are process states in operating systems?
A running instance of a program is known as a process. Depending on their current activity, processes can be in different states and are executed within the system's main memory ( for example, RAM).
Process states
There are five states that a process may be in, namely:
New: When a process is created for performing a particular task, it is in a New state.
Running: When the instructions of a process are being executed, the process is Running.
Waiting: When a process is waiting for an event to occur, such as receiving a data packet, waiting for the user's input, or writing to secondary memory, the process is Waiting.
Ready: When a process has been successfully created but hasn't yet been assigned a processor to begin/resume its execution, it is in the Ready state.
Terminated: When a process has finished its execution, it is in the Terminated state.
Process life cycle
The diagram below illustrates how the process above states interacts during a process's evolution from its creation to its termination.
Note: The numbers in the diagram do not denote the sequence of states, rather, they are just used to label the arrows.
Explanation
The following list corresponds to the arrows in the diagram above:
New
Ready: Once a process is created, it moves into the Ready state and is admitted into the queue of other Ready processes waiting to begin their execution. Ready
Running: Once the assigns a process in the Ready queue to a processor, it begins its execution and moves into the Running state.scheduler A scheduler is a type of system software that handles process scheduling. Running
Waiting: When a process is Running and executes an instruction that requires it to wait for an event (e.g., waiting for the user's input) to occur, the process is moved to the Waiting state to free up the processor for another process's execution. Running
Ready: When a process is Running and an interrupt (e.g., the arrival of a higher priority process) occurs, it is moved to the Ready state to allow the higher priority process to begin execution. Waiting
Ready: Once the event a process was waiting for is completed, the process is moved back into the Ready state. Running
Terminated: Once a process completes its execution successfully, it moves into the Termination state.
Free Resources