PROCESS STATE DIAGRAM

Navneet Gangwar
3 min readMar 27, 2020

--

In order to understand process management of the OS , process state diagram is an essential part to understand .

Have a look at the process state diagram.

Let us look at various states (denoted by an oval ) present in diagram and their roles.

NEW : This state holds the instance of program which is to be put inside the ready queue next. It is to be noted that the instance is still inside the secondary memory only.

READY : This state holds all the processes which are present in the main memory and can be executed as soon as CPU is allocated to them. A new instance of program moves to ready state from new state. A ready queue is maintained for processes which are ready to execute.

LONG TERM SCHEDULER : It is responsible to select jobs that are to be put in the ready queue . A good long term scheduler must select a mix of both I/O and CPU bound jobs for better performance. Also , it is responsible for degree of multi-programming i.e the number of processes present in ready queue.

RUN : This state holds the process which is currently under execution . A process can move from run to terminate on completion. It can also move from run to wait if it waits on some event (like i/o). It can also moves from run to ready based on some priority or scheduling policy.

SHORT TERM SCHEDULER : It is responsible for context switching . Short term scheduler selects a process from ready state and replaces it with the current running process using a dispatcher.

WAIT/BLOCK : Various processes waiting on some I/O or else user intervention gets blocked by the OS . It moves to blocked state and is not considered for further scheduling until the event completes. Upon completion it moves to ready queue.

TERMINATE : When a process completes execution , it moves to terminate state.

SUSPEND WAIT : Sometimes , a lot of processes are waiting for I/O event . In this case there is a need for more new processes to be entered inside the ready queue . In such scenarios , when there is a need of more main memory , certain processes are swapped to hard disk . A process moving from wait state to hard disk moves into suspend wait state.

SUSPEND READY : It is similar to suspend wait . A process moving from ready state to hard disk moves into suspend ready state . Also , if the event on which a process is waiting upon in suspend wait gets completed , it can move to suspend ready state.

MID TERM SCHEDULER: It is responsible for swapping processes between main memory and secondary memory.

Let us consider a problem for better understanding :-

Consider a scenario where there are m processes and n processors . Find the minimum and maximum number of process present in running , ready and wait state.

Next : process scheduling algorithms

--

--