Get free ebooK with 50 must do coding Question for Product Based Companies solved
Fill the details & get ebook over email
Thank You!
We have sent the Ebook on 50 Must Do Coding Questions for Product Based Companies Solved over your email. All the best!

Types of Process Schedulers in OS

Last Updated on June 28, 2023 by Prepbytes

Processes are organized in a variety of stages, including ready, waiting, and operating, using an OS action called process scheduling. Process scheduling allows an OS to specify a time window for the CPU execution of each process. Another significant advantage is that a process scheduling system keeps the CPU active at all times. By doing this, you can encourage programs to respond as soon as feasible.

In the intricate world of operating systems (OS), the efficient management and scheduling of processes play a crucial role in maximizing system performance. The task of process scheduling involves allocating system resources to multiple processes and determining the order in which they are executed. To achieve this, various types of process schedulers have been developed, each employing distinct algorithms and strategies to optimize task execution. In this article, we delve into the realm of process scheduling in operating systems, exploring different types of schedulers and their significance in ensuring smooth and efficient system operations.

Type of Process Schedulers

A form of system software called a scheduler enables you to manage process scheduling.
There are mainly three types of Process Schedulers:

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

What is Long Term Scheduler in OS?

A long-term scheduler (or main memory) moves processes from the JOB queue (or secondary memory) into the READY queue. Or to put it another way, a long-term scheduler chooses which programmes will be loaded into Memory for CPU processing.

Long-term schedulers are often referred to as job schedulers. Long-term schedulers have an impact on the CPU’s efficiency over time. They are responsible for managing every process in the READY queue as well as the level of multiprogramming.

Some operating systems do not have a long-term scheduler. Windows and UNIX are two examples of time-sharing operating systems without a long-term scheduler. These systems store every process for the short-term scheduler in the main memory.

What is the Function of a Long Term Scheduler?

To cut down on processing time, a long-term scheduler’s main goal is to balance CPU bound jobs—those where the CPU consumes the majority of processing time—and I/O bound jobs—those where the I/O operations use the majority of processing time.

Long-term schedulers must maintain a particular level of multiprogramming in order for the average rate at which a process enters the system to be equal to the average rate at which a process exits. The long-term schedulers have plenty of time to decide which processes to add to the queue because executions take some time to complete.

Example of a Long Term Scheduler in OS

Consider a long-term scheduler that is I/O-bound and creates all processes. Since our CPU will be unused the bulk of the time in this scenario, we won’t be using it efficiently. The CPU will be active for a long period, the devices will be idle for the bulk of the time, and the I/O waiting for queue will be idle, on the other hand, if a long-term scheduler starts all CPU-bound processes.

In these cases, we won’t be making full use of our technology. However, we will be fully utilising the system and reducing process time if the long-term scheduler creates processes with the optimum balance of CPU- and I/O-bound workloads.

What is a Short-Term Scheduler?

The short-term scheduler is also known as a CPU scheduler. The main duty of the short-term scheduler is to select a task from the Ready Queue that is ready to start and assign a processor to it. There are more instances of short-term Scheduler execution than long-term Scheduler execution. It has less control in terms of the Multiprogramming Degree. The short-term scheduler is the very minimum available in the Time-Sharing System.

Main Differences between the Long Term Scheduler and Short Term Scheduler

Here, the primary distinctions between the short-term and long-term schedulers are discussed. The long-term scheduler and the short-term scheduler are different in the following ways:

  1. An operating system scheduler known as a long-term scheduler selects tasks from the work queue and loads them for execution in main memory. A short-term scheduler, on the other hand, is responsible for selecting the process from among the many that the CPU executes.
  2. The processes or jobs are chosen by the long-term scheduler from the job pool, while the short-term scheduler picks the processes from the ready queue.
  3. The long-term scheduler controls the degree of multiprogramming, determining how many processes are allowed to be in memory at a given time. On the other hand, the short-term scheduler has less control over multiprogramming.
  4. The long-term scheduler assigns work to the ready queue for further processing by the short-term scheduler, which is also referred to as a job scheduler. The short-term scheduler, also known as a CPU scheduler, then allocates the job to the CPU for its processing.
  5. Compared to the long-term scheduler, the short-term scheduler selects processes from the ready queue more frequently, as it decides which process should execute next.
  6. In terms of speed, short-term scheduling is faster than long-term scheduling as it operates on processes that are already in memory and ready to be executed.

The realm of process scheduling in operating systems encompasses a variety of scheduler types, each designed to optimize task execution and resource allocation in distinct ways. In this article, we explored several types of process schedulers, including First-Come, First-Served (FCFS), Shortest Job Next (SJN), Round Robin (RR), Priority-Based, and Multilevel Queue schedulers.

These schedulers offer different algorithms and strategies to meet specific requirements and achieve desired system performance. FCFS provides simplicity but may lead to suboptimal response times, while SJN aims to minimize waiting times by prioritizing short-duration tasks. RR ensures fair time-sharing by assigning fixed time slices to processes, and priority-based scheduling caters to critical processes based on their assigned priorities. Multilevel Queue scheduling provides flexibility by categorizing processes into different queues.

FAQs Related to Long Term Schedular in OS

Q1: Can I use multiple types of schedulers simultaneously in an operating system?
Yes, it is possible to use multiple types of schedulers simultaneously in an operating system. This approach, known as hybrid scheduling, allows you to leverage the strengths of different schedulers for specific tasks or processes. For example, you may use a priority-based scheduler for critical processes and a round-robin scheduler for time-sharing non-critical processes.

Q2: How do I determine which type of scheduler is best suited for my system?
The choice of scheduler depends on various factors, including the nature of the workload, system requirements, and performance goals. It is crucial to analyze the characteristics of your workload, such as job sizes, arrival patterns, and criticality. Consider factors like fairness, response time, throughput, and resource utilization. Simulation and benchmarking can help evaluate the performance of different schedulers in your specific scenario.

Q3: Can I modify the scheduling algorithm of an existing scheduler?
In some cases, it is possible to modify the scheduling algorithm of an existing scheduler. This often requires a good understanding of the underlying operating system’s code and may involve making changes to the scheduler’s implementation. However, modifying a scheduler should be approached with caution, as it can impact system stability and compatibility.

Leave a Reply

Your email address will not be published. Required fields are marked *