Process and States

Process and States

A Process is a Program when it get invoke. A Program is a passive entity. In Operating System a Process can be in a multiple states. In this blog post we will look into the various states and who-is responsible to move a Process from one state to other state.

  1. New or Create Queue
  2. Ready Queue
  3. Running Queue
  4. Wait or Block Queue
  5. Terminated
  6. Suspend Wait Queue
  7. Suspend Ready Queue

New or Create state is nothing but your programs residing in system disks.

Ready State or Ready Queue is a process in RAM. Before moving we need to understand who is responsible to move the Process from one state to other. We know them as a Schedulers. Schedulers are software's which handle process scheduling.

A Long Term Scheduler is responsible to move process into Ready Queue/State and it Ready State hold n number of processes waiting for there turn to get a CPU cycle. When we move multiple processes from new state to ready queue which is into RAM that is know as multi programmed

A Short Term Scheduler is responsible for moving a process from a Ready Queue to Running Queue. Getting a CPU cycle for a process depends upon the number of cores you have in system. If you have 1 Core CPU it will execute 1 process at any given point of time. A Running Queue also resides in RAM but the state gets changed from a ready to running. If process execution gets completed the state get changed from running to terminate and all resource de-allocation happened. But that's not true all time. There are cases where a process needs to wait or get block before it goes terminated.

When a high priority process comes CPU move the current process in execution back to Ready Queue and execute the high priority process

or

Time Quantum or Time Sharing (when we talk about Multi Tasking) where a CPU executes a process for fix amount of time and move that back to Ready Queue, if a process gets executed in the Time Quantum the process goes to Terminated state. The CPU idleness will be very less but it will be slower in response which means the response time will increase

If a scheduler is executing a process without any wait or block or without any Time Quantum its Non Preemptive type of scheduling. So we can say miltiprogrammed or multiprogramming is Non Preemptive. The response time will be much faster and that's jon-moore-0MKzwPmehRE-unsplash.jpg what the advantage is.

If a scheduler using Time Quantum or dealing with multiple process to and fro its Preemptive type of scheduling.

or

A process needs to access a file or want to some I/O operations the CPU will move the process from a running state to ready state. as I/O operations are much slower as compare to CPU. (CPU works in mips == million instruction per second). A wait/block state also resides in RAM.

From a ready/block state a process cannot directly move to running state rather it needs to go to ready state first and wait for its chance to be move to running state by Long Term Scheduler.

When multiple processes gets move to wait/block state and it gets full the processes move to a new state known as Suspend Wait state and this is handle by a scheduler name as Medium Term Scheduler. A suspend/ wait queue resides in secondary memory. A suspend/wait queue first move to wait/block state and later move to ready queue. If a ready queue is full a process moves to a new state known as Suspend Ready queue.