Process in Operating System | Process State transition diagram | Schedulers

In this article, we will mainly learn about the Process in Operating System, Process State Transition diagram and the types of schedulers.

 

There are mainly 6 states of a Process in operating system –

  1. New – process in secondary memory.
  2. Ready – process in main memory, ready to run.
  3. Run – process runs in main memory.
  4. Block or wait – process in main memory asking for I/O requests.
  5. Termination or completion – every trace about the process is deleted else it is a wastage of memory.
  6. Suspend ready – we move an unimportant process from the main memory to secondary memory from ready state, in order to accommodate a more priority process in main memory. (Secondary memory)

NOTE: There are 2 types of multiprogramming –

      1. with pre-emption – process can be stopped, multi tasking, time sharing
      2. without pre-emption – process cannot be stopped

Operations on Process

There are four stages of operations on a process – 

  1. Creation
  2. Scheduling
  3. Executing
  4. Killing/Delete

Process State transition diagram

Process State Transition diagram
Fig 1.1 Process State Transition
  1. Minimum no. of states that a process has to go through is 4
  2. If a process asks for I/O in the running state, you end it to wait/block state. Placing it in the ready state would lead to repetition of the asking for I/O when it get back again to the running state. Hence, we are trying to make sure that a process that is comes to the running state is always ready to run.
  3. When a high priority process enters the ready state, we can shift back the process in the running state and let the high priority process to run. Even in case, where we try to maintain an interval of time between the processes, running state process is shifted back for the other processes.
  4. Suspended ready is the state that stores the processes shifted from the ready state due to insufficient memory in the ready state in order to accommodate a highly important process. Similarly, if the pushing of process is occurring from the wait/block state, then they will go to suspend wait. Note: New, Suspend ready, Suspend wait are in the Secondary memory.
  5. Once a process in the Suspend Ready/Wait state is ready, it resumes back to their respective states.
  6. When you are pushing a process from wait/block state to suspend wait, it will keep processing its I/O. Once the I/O is over, it is now ready, so we move it from suspend wait to suspend ready, so that next time it comes directly to ready. If we let a process to wait/block state even after completing it’s I/O, the process will still have to wait , i.e., why we push it to the suspend ready state.

NOTE

  1. There are 3 types of decisions we are talking,
      1. no. of processes we have to create and once we decide this, we have to live with it. The no. of processes that has to be created is taken by long term schedular and are called long term decisions.

 

Types of Schedulers

There are 3 types of schedulers:-

  1. Long-term schedulers: takes decision for no. of processes to be taken.
  2. Short-term schedulers: once we have a pool of processes, the decision about which process to run is taken. Also called dispatcher.
  3. Medium-term scheduler: whenever the memory is full, we suspend the process. The suspension decision is made by medium term schedulers.

NOTE:

Degree of multiprogramming – no. of processes that can be present in ready state at max. It is decided by long-term processor.

  1. LT processor decisions are going to have significant impact on the performance of the system. Suppose, LT takes all processes that requires I/O to be performed, then most of the time CPU remains ideal. Therefore, LT should have a mix of both CPU bound and I/O bound processes.

  2. ST schedular will decide which proces to be executed next. After deciding that it will call dispatcher. Dispatcher is a software responsible for moving a process from running state to ready state and from ready state to running state. This process is called context switching. The time taken for CS depends on the size of the context. Therefore, the size of the context has to be as minimal as possible so that the time is less.
  3. We should have a very good short term processor so that it will pick up the processes in such a way that there will be less no. of context switches.
  4. Mid-term schedular is going to affect something called swapping. Swapping is a process of  to affect something called process of moving a process from the main memory to secondary and then back to main memory.
  5. Impacts –
      1. Long-term schedulers: overall performance
      2. Short-term schedulers: context-switching time
      3. Mid-term schedulers: swapping time

Related Links

Leave a Reply