Scheduler (Long-term,Short-term, Medium-term Scheduler) & Dispatcher

本文深入探讨了操作系统中进程调度的概念,包括长、中、短期调度的功能与区别,以及调度算法如何选择进程并分配CPU资源。此外,还介绍了调度器如何控制多程序度,并解释了Dispatcher在进程控制中的作用。
摘要由CSDN通过智能技术生成

What is scheduler?

To execute many processes together on the CPU.

The scheduler selects the process form the ready queue and allocates the CPU to that process…

Ready queue is maintained by any of the scheduling algorithms like First come first served, shortest job first or priority scheduling algorithm etc.

Long-term scheduler

The long-term scheduler selects a job from the job queue and allows a process to load it into the main memory. It means that this is the schedule that handles that how much maximum jobs/processes can be loaded on the main memory.

Sometimes the number of processes submitted to the system are more than it can be executed immediately. Then in such cases, the processes are spooled on the mass storage, where they reside to get executed later.
The Long-Term Scheduler then select the process from this spool which is also called as Job Pool and load them in the Ready Queue for their further execution.

Job Scheduler

Short term scheduler

Short term scheduler selects a process from ready queue and allocates CPU to that process. After this state of a process is change from ready state to running state.

CPU Scheduler

The frequency of Long-Term Scheduler to pick up the processes from Job pool is less as compared to the Short-Term Scheduler.

Differences between Long-term Scheduler & Short-term Scheduler

BASIS FOR COMPARISONBASIS FOR COMPARISONSHORT-TERM SCHEDULER
BasicIt picks up the process from Job Pool/Job Queue.It picks up the process from Ready Queue.
FrequencyLong-Term Scheduler selects the process less frequently.Short-Term Scheduler select the process more frequently.
ControlIt controls the Degree of Multiprogramming.It has less control over the Degree of Multiprogramming.
AlternativeAlternatively, it is called Job Scheduler.Alternatively, it is called CPU Scheduler.
ImportantLong-Term Scheduler is there in Batch Systems but it may or may not be present in Time Sharing System.Short-Term Scheduler is there in Batch System and is minimally present in the Time Sharing System also.

Key Differences Between Long-Term Scheduler and Short-Term Scheduler

  1. The Long -Term Scheduler select the processes from the Job pool. On the other hand, the Short-Term Scheduler selects the processes from the Ready queue.
  2. The Short Term Scheduler executes more frequently as compared to the Long-Term Scheduler.
  3. Long-Term scheduler controls the degree of multiprogramming whereas, the Short-Term Scheduling has less control over the degree of Multiprogramming.
  4. Long-Term Scheduling is also called Job Scheduler. On the other hand, the Short-Term Scheduling is also called CPU Scheduler.
  5. The Long-Term Scheduler is necessarily there in Batch System and may or may not be minimally present in the Time sharing system. On the other hand, the Short-Term Scheduler is there in Batch System and also minimally present in the Time Sharing System.

Medium-term scheduler

Most often, a running process needs I/O operation which doesn’t requires CPU. Hence during the execution of a process when a I/O operation is required then the operating system sends that process from running queue to blocked queue. When a process completes its I/O operation then it should again be shifted to ready queue. ALL these decisions are taken by the medium-term scheduler. Medium-term scheduling is a part of swapping.

The medium-term scheduler can be added if the degree of multiple programming needs to decrease

The degree of multiprogramming describes the maximum number of processes that a single-processor system can accommodate efficiently.

A medium-term scheduler is responsible for swapping. Some jobs are swapped from hard disk to the main memory and some jobs can be swapped out from the main memory to the hard disk.

Dispatcher

The dispatcher is the module that gives a process control over the CPU after it has been selected by the short-term scheduler.
Function as Following Steps:

  1. Context Switching
  2. Switch to user mode
  3. Jumping to proper location when process again restarted

The time taken by dispatcher is called dispatch latency.
Scheduler and Dispatcher

Reference

https://techdifferences.com/difference-between-long-term-and-short-term-scheduler.html
https://www.geeksforgeeks.org/difference-between-dispatcher-and-scheduler/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值