Table of contents
1.
Introduction
2.
Types of Schedulers
2.1.
Long Term or Job Scheduler
2.2.
Short Term or CPU Scheduler
2.3.
Medium Term Scheduler
3.
Frequently Asked Questions
3.1.
What does a process scheduler do?
3.2.
What are the three process schedulers?
3.3.
Why is process scheduling required?
3.4.
How many scheduling algorithms are there?
4.
Conclusion
Last Updated: Mar 27, 2024

Process Scheduler

Author Amit Singh
0 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?
Operating System

Introduction

Process scheduling is one of the most critical activities of the process manager. This activity involves removing the running process from the CPU and selecting another process based on a specific strategy. Process scheduling ensures that the CPU is being used at maximum efficiency to minimize the CPU idle time.

Multiple processes can be loaded into executable memory at the same time in such operating systems, and the loaded processes share the CPU by time multiplexing. 

That is why schedulers are used to arrange the processes that ask for resources in order and remove the process whose task is completed. This complete process increases the efficiency and improves the quality of multiprogramming operating systems.

In this article, we will learn about process schedulers in operating systems

So, let’s get started now: 

Recommended Topic, FCFS Scheduling Algorithm, Multiprogramming vs Multitasking

Types of Schedulers

There are three types of process schedulers:

  1. Long Term Scheduler
  2. Short Term Scheduler
  3. Medium Term Scheduler

Let us study each of these schedulers one by one, starting from the long-term scheduler.

Schedulers

Also see, Difference between Dispatcher and Scheduler, Open Source Operating System

Long Term or Job Scheduler

The job scheduler is another name for the long-term scheduler. It selects processes from the pool (secondary memory) and arranges them in the ready queue that is present in the main memory.

Long Term Scheduler is responsible for controlling the degree of Multiprogramming

The goal of the long-term scheduler is to select the best mix of I/O and CPU-bound processes from the pool of jobs. 

This is very crucial that a long-term or job scheduler carefully arrange these CPU-bound and I/O-bound processes.

  • If the job scheduler selects more IO-bound processes, all of the jobs may become stuck, and the CPU will be idle for the majority of the time. Due to this, the degree of multiprogramming will be reduced. 
  • As a result, if we design processes with a high CPU bound or a perfect balance between I/O and CPU bound, the system's overall performance will improve.
     

That is why the long-term scheduler's job is crucial and could have a long-term impact on the system.

Short Term or CPU Scheduler

CPU scheduler is another name for the short-term scheduler. It chooses one of the Jobs from the ready queue and sends it to the CPU for processing.

To determine which job from the ready queue will be dispatched for execution, a scheduling algorithm is used. The short-term scheduler's task can be essential in the sense that if it chooses a job with a long CPU burst time, all subsequent jobs will have to wait in the ready queue for an extended period.

This problem is known as starvation, and it occurs if the short-term scheduler makes a mistake when selecting the process.

Note: Short-term scheduler only determines the process that is needed to be scheduled; it doesn't actually load the process on running.

For loading the processes, the dispatcher comes into the picture. 

A dispatcher does the following: 

  1. Context-switch.
  2. Then switching to user mode.
  3. Jumping to the proper location in the newly loaded program.

Medium Term Scheduler

Medium Term Scheduler is responsible for handling the swapped-out processes. If the running state of the processes requires some IO time to complete, the state must be changed from running to waiting.

To accomplish this task, the medium-term scheduler is used. It stops the process from executing in order to make space for other processes. These processes are called swapped-out processes, and the operation is known as swapping. The medium-term scheduler handles the stopping or suspending, and restarting processes.

You can also read about layered structure of operating system.

Frequently Asked Questions

What does a process scheduler do?

A process scheduler selects processes from the ready queue and loads them into memory so that they can be executed. The process is loaded into the memory for CPU scheduling. The primary objective of the job scheduler is to provide a balanced mix of jobs, such as I/O bound and processor bound. It also controls the degree of multiprogramming.

What are the three process schedulers?

There are three types of Process Schedulers: 

  1. Long Term Schedulers, 
  2. Short Term Schedulers, and 
  3. Medium Term Schedulers.

Why is process scheduling required?

An operating system uses process scheduling to ensure that processes execute efficiently and have reduced wait times. Process scheduling policies aim to use CPU resources wisely, increase throughput, reduce wait time, and increase response and turnaround times.

How many scheduling algorithms are there?

There are six types of process scheduling algorithms are: 

  • First Come First Serve (FCFS), 
  • Shortest-Job-First (SJF) Scheduling,
  • Shortest Remaining Time,
  • Priority Scheduling,
  • Round Robin Scheduling, 
  • Multilevel Queue Scheduling.

Conclusion

In this article, we have studied schedulers in operating systems. We have also discussed the types of the scheduler in detail.

We hope that this article has provided you with the help to enhance your knowledge regarding multitasking operating systems and if you would like to learn more, check out our articles on segmentation vs paging, inverted paging, and multitasking

Recommended Readings: 


Do check out The Interview guide for Product Based Companies as well as some of the Popular Interview Problems from Top companies like Amazon, Adobe, Google, Uber, Microsoft, etc. on Coding Ninjas Studio.

Also check out some of the Guided Paths on topics such as Data Structure and Algorithms, Competitive Programming, Operating Systems, Computer Networks, DBMS, System Design, etc. as well as some Contests, Test Series, Interview Bundles, and some Interview Experiences curated by top Industry Experts only on Coding Ninjas Studio.

Merry Learning!

Live masterclass