The process scheduling is the activity of the process manager that handles the removal of the running process from the CPU and the selection of another process on the basis of a particular strategy. Process scheduling is an essential function of a Multi-programming operating system. Such operating systems allow more than one process to be loaded into the executable memory at a time and loaded process shares the CPU using time multiplexing. The process scheduler is that part of operating system which decides whether a program should continue running or not and if not, then which program to run next.
Scheduling queues refers to the queues of processes or devices. When the process enters into the system, this process is put into a job queue. This queue consists of all processes in the system. The operating system also maintains other queues such as device queue.
Types of scheduling
Schedulers are special system software which handles process scheduling in various ways.Their main task is to select the jobs to be submitted into the system and to decide which process to run. Schedulers are of three types
- Long Term Scheduler
- Short Term Scheduler
- Medium Term Scheduler
Long Term Scheduler
It is also called job scheduler. Long term scheduler determines which programs are admitted to the system for processing and which programs are left unattended in the background for execution. The main function of Job scheduler is to select processes from that queue and load them into memory for execution. Now-a-days these schedulers are known as workload automation.
Short Term Scheduler
It is also called CPU scheduler. Main objective of this scheduler is to increase the system performance in accordance with the chosen set of criteria and allow access of the resources to the different threads, programs, etc. It is the change of ready state of a process to the running state. CPU scheduler selects a process among the set of processes that are ready to be executed.
Medium Term Scheduler
Medium term scheduling is part of the swapping. It removes the processes from the memory. It reduces the degree of multiprogramming. The medium term scheduler is in-charge of handling the swapped out-processes.
Some of the scheduling algorithms are:-
- First Come First Serve: This algorithm executes the processes in order of their arrival
- Shortest Remaining Time First or Shortest Job First: This algorithm is a preemptive scheduling algorithm. It executes a process and as soon as its remaining time gets higher than some other process then it switches to execute that another process that is having less execution time left and so on.
- Priority Scheduling: This scheduling algorithm is also a preemptive scheduling algorithm. This works same as the Shortest Job First algorithm. The only difference is that for this scheduling each process must be assigned some priority as it will be executing the processes according to the priorities of the processes, i.e., one with higher priority will be executed first.
- Round Robin Scheduling: This algorithm works on time slot basis, i.e., a time slice is assigned to each process. This algorithm executes each process for the mentioned time slice and then shifts to another process and so on. The benefit of this algorithm is that each process gets executed simultaneously for which one process does not have to wait long to be executed.