Open In App

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: 



 



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:

Types of Schedulers

  1. 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.
  2. 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.
  3. 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.

Multiprogramming 

We have many processes ready to run. There are two types of multiprogramming:

  1. Preemption – Process is forcefully removed from CPU. Pre-emption is also called time sharing or multitasking.
  2. Non-preemption – Processes are not removed until they complete the execution. Once control is given to the CPU for a process execution, till the CPU releases the control by itself, control cannot be taken back forcibly from the CPU.

Degree of Multiprogramming 

The number of processes that can reside in the ready state at maximum decides the degree of multiprogramming, e.g., if the degree of programming = 100, this means 100 processes can reside in the ready state at maximum.

Operation on the Process

1. Creation: The process will be ready once it has been created, enter the ready queue (main memory), and be prepared for execution.

2. Planning: The operating system picks one process to begin executing from among the numerous processes that are currently in the ready queue. Scheduling is the process of choosing the next process to run.

3. Application: The processor begins running the process as soon as it is scheduled to run. During execution, a process may become blocked or wait, at which point the processor switches to executing the other processes.

4. Killing or Deletion: The OS will terminate the process once its purpose has been fulfilled. The process’s context will be over there.

5. Blocking: When a process is waiting for an event or resource, it is blocked. The operating system will place it in a blocked state, and it will not be able to execute until the event or resource becomes available.

6. Resumption: When the event or resource that caused a process to block becomes available, the process is removed from the blocked state and added back to the ready queue.

7. Context Switching: When the operating system switches from executing one process to another, it must save the current process’s context and load the context of the next process to execute. This is known as context switching.

8. Inter-Process Communication: Processes may need to communicate with each other to share data or coordinate actions. The operating system provides mechanisms for inter-process communication, such as shared memory, message passing, and synchronization primitives.

9. Process Synchronization: Multiple processes may need to access a shared resource or critical section of code simultaneously. The operating system provides synchronization mechanisms to ensure that only one process can access the resource or critical section at a time.

10. Process States: Processes may be in one of several states, including ready, running, waiting, and terminated. The operating system manages the process states and transitions between them.

Features of the Process State


Article Tags :