Skip to content

Process Management

  • A program in execution is called a process.

Attributes of a process

  1. Process ID

  2. When a process is created, a unique id is assigned to the process which is used for unique identification of the process in the system.

  3. Program Counter

  4. A program counter stores the address of the last instruction of the process on which the process was suspended.

  5. The CPU uses this address when the execution of this process is resumed.

  6. Process State

  7. The Process, from its creation to the completion, goes through various states.

  8. Priority

  9. Every process has its own priority.

  10. The process with the highest priority among the processes gets the CPU first.
  11. This is also stored on the process control block.

  12. General Purpose Registers

  13. Every process has its own set of registers which are used to hold the data which is generated during the execution of the process.

  14. List of open files

  15. During the Execution, Every process uses some files which need to be present in the main memory.

  16. OS also maintains a list of open files in the PCB.

  17. List of open devices

  18. OS also maintain the list of all open devices which are used during the execution of the process.

State of a Process

  1. New

  2. A program which is going to be picked up by the OS into the main memory is called a new process.

  3. Ready

  4. The processes which are ready for the execution and reside in the main memory are called ready state processes.

  5. There can be many processes present in the ready state.

  6. Running

  7. One of the processes from the ready state will be chosen by the OS depending upon the scheduling algorithm.

  8. Block/wait

  9. When a process waits for a certain resource to be assigned or for the input from the user then the OS move this process to the block or wait state and assigns the CPU to the other processes.

  10. Suspend Ready

  11. A process in the ready state, which is moved to secondary memory from the main memory due to lack of the resources (mainly primary memory) is called in the suspend ready state.

  12. Suspend Wait

  13. Instead of removing the process from the ready queue, it's better to remove the blocked process which is waiting for some resources in the main memory.

  14. Since it is already waiting for some resource to get available hence it is better if it waits in the secondary memory and make room for the higher priority process.
  15. These processes complete their execution once the main memory gets available and their wait is finished.

  16. Termination:

  17. When a process finishes its execution, it comes in the termination state.
  18. All the context of the process (Process Control Block) will also be deleted the process will be terminated by the Operating system.

Operation on a process

  1. Creation

  2. Once the process is created, it will be ready and come into the ready queue (main memory) and will be ready for the execution.

  3. Scheduling

  4. Out of the many processes present in the ready queue, the Operating system chooses one process and start executing it.

  5. Selecting the process which is to be executed next, is known as scheduling.

  6. Execution

  7. Once the process is scheduled for the execution, the processor starts executing it.

  8. Process may come to the blocked or wait state during the execution then in that case the processor starts executing the other processes.

  9. Deletion/Killing

  10. Once the purpose of the process gets over then the OS will kill the process.
  11. The Context of the process (PCB) will be deleted and the process gets terminated by the Operating system.

Process Schedulers

  1. Long Term Scheduler

  2. Long term scheduler is also known as job scheduler.

  3. It chooses the processes from the pool (secondary memory) and keeps them in the ready queue maintained in the primary memory.

  4. Long Term scheduler mainly controls the degree of Multiprogramming. The purpose of long term scheduler is to choose a perfect mix of IO bound and CPU bound processes among the jobs present in the pool.

  5. If the job scheduler chooses more IO bound processes then all of the jobs may reside in the blocked state all the time and the CPU will remain idle most of the time. This will reduce the degree of Multiprogramming.

  6. Short Term Scheduler

  7. Short term scheduler is also known as CPU scheduler. It selects one of the Jobs from the ready queue and dispatch to the CPU for the execution.

  8. A scheduling algorithm is used to select which job is going to be dispatched for the execution.

  9. The Job of the short term scheduler can be very critical in the sense that if it selects job whose CPU burst time is very high then all the jobs after that, will have to wait in the ready queue for a very long time.

  10. This problem is called starvation which may arise if the short term scheduler makes some mistakes while selecting the job.

  11. Medium Term Scheduler

  12. Medium term scheduler takes care of the swapped out processes.If the running state processes needs some IO time for the completion then there is a need to change its state from running to waiting.

  13. It removes the process from the running state to make room for the other processes. Such processes are the swapped out processes and this procedure is called swapping. The medium term scheduler is responsible for suspending and resuming the processes.


Process Queue

  1. Job Queue

  2. In starting, all the processes get stored in the job queue. It is maintained in the secondary memory.

  3. The long term scheduler (Job scheduler) picks some of the jobs and put them in the primary memory.

  4. Ready Queue

  5. Ready queue is maintained in primary memory.

  6. The short term scheduler picks the job from the ready queue and dispatch to the CPU for the execution.

  7. Waiting Queue

  8. When the process needs some IO operation in order to complete its execution, OS changes the state of the process from running to waiting.

  9. The context (PCB) associated with the process gets stored on the waiting queue which will be used by the Processor when the process finishes the IO.


  1. Arrival Time

  2. The time at which the process enters into the ready queue is called the arrival time.

  3. Burst Time

  4. The total amount of time required by the CPU to execute the whole process is called the Burst Time.

  5. This does not include the waiting time.
  6. It is confusing to calculate the execution time for a process even before executing it hence the scheduling problems based on the burst time cannot be implemented in reality.

  7. Completion Time

  8. The Time at which the process enters into the completion state or the time at which the process completes its execution, is called completion time.

  9. Turnaround time

  10. The total amount of time spent by the process from its arrival to its completion, is called Turnaround time.

  11. Waiting Time

  12. The Total amount of time for which the process waits for the CPU to be assigned is called waiting time.

  13. Response Time

  14. The difference between the arrival time and the time at which the process first gets the CPU is called Response Time.

CPU Scheduling

  • In Multiprogramming systems, the Operating system schedules the processes on the CPU to have the maximum utilization of it and this procedure is called CPU scheduling.

  • Whenever the running process requests some IO operation then the short term scheduler saves the current context of the process (also called PCB) and changes its state from running to waiting. During the time, process is in waiting state; the Short term scheduler picks another process from the ready queue and assigns the CPU to this process. This procedure is called context switching.

  • The Operating system maintains a process control block during the lifetime of the process. The Process control block is deleted when the process is terminated or killed. PCB

  • In Multiprogramming, if the long term scheduler picks more I/O bound processes then most of the time, the CPU remains idol. The task of Operating system is to optimize the utilization of resources.

  • If most of the running processes change their state from running to waiting then there may always be a possibility of deadlock in the system. Hence to reduce this overhead, the OS needs to schedule the jobs to get the optimal utilization of CPU and to avoid the possibility to deadlock.


Scheduling Algorithms

  • There are various algorithms which are used by the Operating System to schedule the processes on the processor in an efficient way.

  • First Come First Serve

  • It is the simplest algorithm to implement.

  • The process with the minimal arrival time will get the CPU first.
  • The lesser the arrival time, the sooner will the process gets the CPU.
  • It is the non-preemptive type of scheduling.

  • Round Robin

  • In the Round Robin scheduling algorithm, the OS defines a time quantum (slice).

  • All the processes will get executed in the cyclic way.
  • Each of the process will get the CPU for a small amount of time (called time quantum) and then get back to the ready queue to wait for its next turn.
  • It is a preemptive type of scheduling.

  • Shortest Job First

  • The job with the shortest burst time will get the CPU first.

  • The lesser the burst time, the sooner will the process get the CPU.
  • It is the non-preemptive type of scheduling.

  • Shortest remaining time first

  • It is the preemptive form of SJF.

  • In this algorithm, the OS schedules the Job according to the remaining time of the execution.

  • Priority based scheduling

  • In this algorithm, the priority will be assigned to each of the processes.

  • The higher the priority, the sooner will the process get the CPU.
  • If the priority of the two processes is same then they will be scheduled according to their arrival time.

  • Highest Response Ratio Next

  • In this scheduling Algorithm, the process with highest response ratio will be scheduled next.
  • This reduces the starvation in the system.

Some Terminologies

  1. Convoy Effect / Starvation

  2. If the CPU gets the processes of the higher burst time at the front end of the ready queue then the processes of lower burst time may get blocked which means they may never get the CPU if the job in the execution has a very high burst time.

  3. This is called convoy effect or starvation.

  4. Priority Scheduling

  5. In Priority scheduling, there is a priority number assigned to each process.
  6. The Process with the higher priority among the available processes is given the CPU.
  7. There are two types of priority scheduling algorithm exists.
    • One is Preemptive priority scheduling
    • While the other is Non Preemptive Priority scheduling.
  8. The priority number assigned to each of the process may or may not vary.
  9. If the priority number doesn't change itself throughout the process, it is called static priority, while if it keeps changing itself at the regular intervals, it is called dynamic priority.

Non-Preemptive Priority Scheduling

  • In the Non Preemptive Priority scheduling, The processes are scheduled according to the priority number assigned to them. Once the process gets scheduled, it will run till the completion.

Preemptive Priority Scheduling

  • In Preemptive Priority Scheduling, at the time of arrival of a process in the ready queue, its Priority is compared with the priority of the other processes present in the ready queue as well as with the one which is being executed by the CPU at that point of time.
  • The One with the highest priority among all the available processes will be given the CPU next.