Open In App

Short Term Scheduler in Operating System

Improve
Improve
Like Article
Like
Save
Share
Report

Pre-requisites: Process Schedulers in Operating System

The operating system’s short-term scheduler, commonly referred to as a CPU scheduler, controls how the central processing unit (CPU) is allotted to processes. The short-term scheduler’s major objective is to make sure that the CPU is constantly utilized effectively and efficiently.

The short-term scheduler operates by continuously keeping track of the status of all the system’s processes. The scheduler chooses a process from the ready queue when it is prepared to run and allows the CPU to do it. The process then continues to operate until it either completes its work or runs into an I/O activity that blocks it.

The short-term scheduler can employ a variety of scheduling methods, each of which has advantages and disadvantages of its own. Several well-liked algorithms include:

  • First-Come, First-Served (FCFS): This method simply carries out the operations in the order in which the system receives them.
  • Shortest Job First (SJF): This algorithm chooses the process to run next based on its predicted runtime.
  • Priority Scheduling: This algorithm gives each process a priority rating and chooses the process with the highest rating to run next.
  • Round Robin: This algorithm cycles around the ready queue, giving each process a chance to run, allotting each process a fixed time slice (referred to as a time quantum).

The system-specific needs determine the scheduling algorithm be used. A batch system might employ an SJF algorithm to reduce the overall completion time of all activities, whereas a real-time system might utilize a priority scheduler to guarantee that key tasks are executed promptly.

The short-term scheduler controls how effectively and efficiently the CPU is used, which is essential for the system’s overall performance. The short-term scheduler can help to reduce process waiting times and maximize CPU use with the right scheduling algorithm and suitable time quantum.

Functions

The central processing unit (CPU) allocation to processes is controlled by the short-term scheduler, also referred to as the CPU scheduler. The short-term scheduler specifically carries out the following duties:

  • Process Selection: The scheduler chooses a process from the list of available processes in the ready queue, which is where all of the processes are waiting to be run. A scheduling algorithm, such as First-Come, First-Served (FCFS), Shortest Job First (SJF), Priority Scheduling, or Round Robin, is typically used to make the selection.
  • CPU Allocation: The scheduler assigns the CPU to a process after it has been chosen, enabling it to carry out its instructions.
  • Preemptive Scheduling: The scheduler can also preempt a running process, interrupting its execution and returning the CPU to the ready queue if a higher-priority process becomes available.
  • Context Switching: When a process is switched out, the scheduler saves the context of the process, including its register values and program counter, to memory. When the process is later resumed, the scheduler restores this saved context to the CPU.
  • Process Ageing: Process aging is a function of the scheduler that raises a process’ priority when it has been sitting in the ready queue for a long time. This aids in avoiding processes becoming locked in an endless waiting state.
  • Process synchronization and coordination: In order to prevent deadlocks, race situations, and other synchronization problems, the scheduler also synchronizes shared resource access among processes and coordinates their execution and communication.
  • Load balancing: The scheduler also distributes the workload among multiple processors or cores to optimize the system’s performance.
  • Power management: The scheduler also manages the power consumption by adjusting the CPU frequency and turning off the cores that are not currently in use.
Short Term Scheduler in Operating System

 

Overall, the short-term scheduler plays a vital role in the overall performance of the system by ensuring that the CPU is being used effectively and efficiently. It makes decisions on which process to execute next, and how much time to allocate to each process, to minimize waiting time for processes and optimize the utilization of the CPU.

For more details please read the article Difference between Short-Term, Medium-Term, and Long-Term Scheduler. 


Last Updated : 28 Jan, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads