What is Scheduling in Operating System? Definition, Need, Types & Algorithms - Binary Terms (2024)

Scheduling in operating system is the process of selecting a process from a ready queue. And allotting CPU to this process for execution. The operating system schedules the processes in such a way that the CPU doesn’t sit idle. And keeps processing some or the other process.

Scheduling is an important part of an operating system. As perfect scheduling increases the efficiency of the operating system. In this content, we will be discussing scheduling in more detail.

Content: Scheduling in Operating System

  1. What is Scheduling?
  2. What is its Need?
  3. Scheduling Queue
  4. Types of Scheduler
  5. Scheduling Criteria
  6. Scheduling Algorithm

What is Scheduling in Operating System?

Scheduling is the process of allotting the CPU to the processes present in the ready queue. We also refer to this procedure as process scheduling.

The operating system schedules the process so that the CPU always has one process to execute. This reduces the CPU’s idle time and increases its utilization.

The part of OS that allots the computer resources to the processes is termed as a scheduler. It uses scheduling algorithms to decide which process it must allot to the CPU.

Why Scheduling in Operating System is Important?

In your day to day life, you schedule your work sequences to get:

  • better efficiency.
  • reduce any kind of delay.
  • even waiting time.

Like in the morning you wake up, have breakfast, work for some hours take lunch, again resume your work, at night have dinner and go to bed. Doing this way, you make your day more logical and efficient.

Similarly, the operating system schedules the processes to achieve maximum CPU utilization. The processor can keep several processes in the main memory in the multiprogramming environment. And some or the other processes must be running at all times.

As we know a typical process has both I/O times as well as CPU time. When a process completes its CPU time and now needs to perform I/O operation. The operating system takes the CPU from this process. And provides it to the other process waiting for the CPU. In this way, the operating system manages the CPU resources in an efficient way.

The operating system schedules every computer resource before providing it to the process.

Scheduling Queue

The operating system maintains some queues. These queues sort out the scenario that which the process is waiting for what kind of operation. The queues maintained by the system are as follows:

  • Job Queue
    As soon as any process enters the system, the system assembles it in the job queue. The system stores the job queue on the mass storage device i.e. secondary memory.

  • Ready Queue
    If the process is ready for execution, Os brings it to the ready queue i.e. in the main memory. The process in the ready queue is the one those are waiting to get the CPU cycle.

  • Device Queue
    The operating system maintains a separate device queue for each I/O device. This device queue holds the processes that are waiting to perform I/O on the device.

Well, both the device queue and ready queue maintain the PCB for the processes they are carrying. I have briefly explained the process control block (PCB) in my earlier content. PCB of a process stores the relative information of the process such as:

Scheduling Queue Sequences

The process that is ready for execution is brought into the ready queue from the job queue. In the ready queue, it waits until the scheduler allots the CPU to the process. Once the process gets CPU and starts execution following sequence may take place:

What is Scheduling in Operating System? Definition, Need, Types & Algorithms - Binary Terms (1)

  1. While execution, the process may create a new process. Then the system suspends the parent process until the child process terminates. Once the child process terminates the parent process is put back into the ready queue.
  2. If the time allotted to process for execution gets expired. And if the process execution isn’t completed the scheduler put it back in the ready queue.
  3. If an interrupt occurs during the process execution, the processor suspends its execution. It handles the interrupt first and then puts the process back in the ready queue.
  4. During execution, if the process wants to perform an I/O operation, the system stores it in the device queue. After it completes its I/O operations, the system puts it back into the ready queue.
  5. If the process completes its execution, the processor terminates it. And it deallocates the PCB related to the process. It also releases the resources allotted to the process.

Types of Scheduler

Above we have discussed three scheduling queues. A process migrates among these queues before it terminates. The scheduler picks an appropriate process from these queues to maximize CPU utilization.

This schedular can be further distinguished as:

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

Long Term Scheduler/ Process Scheduling/ Job Scheduling

The long-term schedular picks the process from the mass storage device such as a hard disk. And places it in the ready queue that is in the main memory.

Why do we term it Long-Term Scheduling?

Because this scheduler selects a new process from the mass storage less frequently. The creation of new processes one after the other is at least separated by the minutes of duration.

The long-term scheduler decides the degree of multiprogramming. If the degree of multiprogramming is stable. Then the average rate of process creation is equal to the average rate of process departure.

In this condition, the long-term scheduler has to select a process from the mass storage. Only when a process leaves or departs the system.

Short Term Scheduler/ CPU Scheduling

The short-term schedular picks one process from the ready queue. And allots the CPU to this process.

Why do we term it Short-Term Scheduler?

Because this scheduler frequently selects the process from the ready queue. And allots it to the CPU. As the processes include both I/O time and CPU time. They keep on switching between the CPU and I/O devices.

Thus, the CPU scheduler schedules the processes more frequently. The CPU scheduling is further classified into two types:

  1. Preemptive Scheduling
    In this scheduling, the schedular allots CPU to a process for a limited amount of time. The processor preempts the execution of a process if the process with higher priority occurs.
  2. Non-Preemptive Scheduling
    In this scheduling, once the schedular allots the CPU to any process, the process doesn’t release the CPU. Until it gets terminated or it switches to the waiting state.

Medium Term Scheduler

The medium-term scheduler removes the partially executed process from the ready queue. This reduces the degree of multiprogramming. This process can be later reintroduced in the ready queue. And they can resume the execution from where it left off. This procedure is also referred to as swapping.

Scheduling Criteria

Scheduling criteria help to compare scheduling algorithms.

  • CPU Utilization
    CPU utilization must be high, this is possible if the CPU is busy all-time executing one or the other process.
  • Throughout
    Throughput is the number of processes executed by the CPU per unit of time.
  • Turnaround Time
    Turnaround time is the time required by the process to execute completely. We count this time from the moment the process comes in the ready queue. Till the process completes its execution.
  • Waiting Time
    Waiting time is time spent by the process in the ready queue.
  • Response Time
    Response time is the time counted from the moment the process comes to the ready queue. Till the process produces the first result.

Scheduling Algorithm

The scheduling algorithm helps the scheduler in deciding which process it must pick from the ready queue. There are several scheduling algorithms as discussed below:

  1. First-Come, First-Served Scheduling
    The processor services the processes in the sequence they arrive in the ready queue.
  2. Shortest-Job-First Scheduling
    The processor services the shortest process in the ready queue first.
  3. Priority Scheduling
    The processor services the process with high priority in the ready queue first.
  4. Round-Robin Scheduling
    This is similar to the first-in-first-out scheduling. As the process arriving first in the ready queue will be serviced first.
    But the processor preempts the process after a time quantum. And placed back in the ready queue, the next process in the ready queue is given a chance to execute.

There are a few more algorithms for scheduling the process. We will discuss them in some of our later content.

So, scheduling is the important part of the operating system that controls the degree of multiprogramming. Thus perfect scheduling increases the CPU utilization making the system more efficient.

Related Terms:

  1. First Come First Serve (FCFS) Scheduling Algorithm
  2. Multiple Processor Scheduling
  3. Process in Operating System
  4. Parallel Processing
  5. Contiguous Memory Allocation
What is Scheduling in Operating System? Definition, Need, Types & Algorithms - Binary Terms (2024)
Top Articles
Latest Posts
Article information

Author: Horacio Brakus JD

Last Updated:

Views: 6489

Rating: 4 / 5 (51 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Horacio Brakus JD

Birthday: 1999-08-21

Address: Apt. 524 43384 Minnie Prairie, South Edda, MA 62804

Phone: +5931039998219

Job: Sales Strategist

Hobby: Sculling, Kitesurfing, Orienteering, Painting, Computer programming, Creative writing, Scuba diving

Introduction: My name is Horacio Brakus JD, I am a lively, splendid, jolly, vivacious, vast, cheerful, agreeable person who loves writing and wants to share my knowledge and understanding with you.