Lifecycle of a Process

Muskaan Parmar
3 min readJul 15, 2021

--

The Process States or the Lifecycle of a Process is demonstrated below :

PRIMARY STATES

  1. New :
    In this state the process begins to get created . It is present in the secondary memory.
  2. Ready :
    Now the processes get transferred to the RAM (Main Memory).Since there is a limitation on the size of RAM , only a few processes can be send from the new state(secondary memory) to the ready queue .
    It is the responsibility of the LTS(Long Term Scheduler) to bring the processes from secondary to main memory .
  3. Running :
    This is where the execution of there processes from the ready queue begin.The processes are scheduled/dispatched by the CPU.
    Short Term Scheduler is responsible to give control from the ready to the running state.
    The number of processes transferred from the ready queue to the running state depends upon the number of CPU’s. If it is a uniprocessor system , only one process is send from ready to running state. The Processes transferred to the running state are still inside the RAM(Main Memory) but there state , is changed.

Now below mentioned things can happen

  1. The instructions start to execute one by one. If the instructions of a process are completed it reaches to the TERMINATED state . The resources/memory are then deallocated .
  2. If a process with higher priority arrives , then the ongoing process is pushed back to the ready queue by the CPU and the higher priority one is send to the running state for its execution .
  3. If the CPU is scheduling processes , on the basis of Time Quantum then , after the time quantum expires , the ongoing process is moved again to the ready queue (is it hasn’t yet terminated) and the next process begin its execution .

If no other process begins , without the ongoing one terminated then that is called Non Preemptive .
If some other process starts in between any ongoing process , then multitasking is done and it is called Preemptive .

In all these cases the CPU is the deciding Factor

If any Process requests for Input/Output operations , then it gets transferred to the wait/block state , and after Completion goes to the ready queue. This is also inside RAM , but the state gets changed.

ADDITIONAL STATES

  1. In the Worst scenario , it may happen that all the processes demand i/o devices , causing all the processes to fill up in the wait/block queue .
    But since it also has a limited size , some of the processes get transferred to
    SUSPEND WAIT state inside the secondary memory and they continue there work from there .
    If the wait/block queues frees up space , it is put back into the wait/block queue from where it can further reach the ready state .
    The Medium term scheduler is responsible for sending the process from wait/block to suspend wait queue.
  2. In case if the ready queue is filled and some other process of higher priority arrives , then the process has to be send to SUSPEND READY queue. Mid Term Scheduler is responsible for this .
  3. If the wait/block state doesn’t get empty then the process from the
    SUSPEND WAIT queue can go directly to the SUSPEND READY queue , and from that ,it can reach the ready queue.

--

--

Muskaan Parmar
Muskaan Parmar

Written by Muskaan Parmar

Coding , just how I like it !❤

No responses yet