What Does a Central Scheduler Do?
In computing, algorithmic scheduling is a method by which a specified job is assigned to a resource that completes the job. This work can be a virtual computing element, such as a thread, process, or data stream, which in turn is scheduled to a hardware resource such as a processor, a network link, or an expansion card.
- The process scheduler is part of the operating system that decides which process to run at a specific point in time. It is usually able to suspend a running process, move it behind the running queue and start a new process; such a scheduler is called a preemptive scheduler, otherwise it is a cooperative scheduler.
(FCFS) Algorithm scheduling first come first serve (FCFS) scheduling algorithm
- FCFS is scheduled according to the order in which jobs / processes enter the system. Those who enter the system first are scheduled first; that is, the job / process with the longest waiting time is started. Is the simplest scheduling algorithm, which can be used for job scheduling and process scheduling.
- First-come-first-served (first-in-first-out) advantages and disadvantages 1. It is more conducive to long jobs (processes), but not short jobs (processes).
2. Conducive to CPU busy jobs (processes), not conducive to I / O busy jobs (processes).
3. Used for batch processing system, not suitable for time-sharing system.
SJF Algorithm Scheduling Short Job Priority Scheduling Algorithm (SJF)
- SJF is to select a job with the shortest estimated running time from the queue, which can be used for job scheduling and process scheduling.
- SJF scheduling algorithm also has disadvantages that cannot be ignored 1. It is not good for long jobs. Seriously, if a long job (process) enters the system's backup queue (ready queue), the scheduler always prioritizes those short jobs (processes) (even those that come later), which will lead to long jobs (processes) and long Not scheduled-hungry.
2. The urgency of the operation (process) is not considered at all, so there is no guarantee that the urgent operation (process) will be processed in a timely manner.
3. Because the length of the job (process) is only based on the estimated execution time provided by the user, and the user may intentionally or unintentionally shorten the estimated running time of his job, the algorithm may not be able to really achieve short jobs Priority scheduling.
Algorithm scheduling high response ratio priority scheduling algorithm
- The high response ratio priority scheduling algorithm considers both the execution time of the job and the waiting time of the job. It combines the characteristics of the first-come-first-served and shortest job-first algorithms.
- The response ratio in this algorithm refers to the job waiting time and the running ratio. The response ratio formula is defined as follows: response ratio = (waiting time + requested service time) / requested service time
- Advantages: For jobs with the same waiting time, the shorter the required service time, the higher the priority, which is beneficial for short jobs. Jobs that require the same service time, the longer the waiting time, the higher the priority, the first come first served. For long jobs, the priority increases as the waiting time increases. When the waiting time is long enough, the priority can be raised to a high level, so that a processor can also be obtained, which is advantageous for long jobs. It is a compromise that not only takes care of short assignments, but also considers the order of arrival of assignments, and does not make long assignments unavailable for long periods of time [1] .
- Disadvantage: The response ratio calculation is performed, which increases the system overhead .
(RRRound Robin) Algorithm scheduling simple time slice rotation method (RR-Round Robin)
- The system arranges all ready processes into a queue on a first-come-first-served basis. Each time it is dispatched, the CPU is allocated to the head-of-team process and executed for a time slice. When the execution time slice runs out, a The timer sends a clock interrupt request, and the scheduler stops the execution of the process and puts it at the end of the ready queue; then, it assigns the processor to the new head of the ready queue; the size of the time slice ranges from a few ms to several hundred ms.
- Cons: Slow response to urgent tasks. The time slice selection is too small, frequent interruptions, process context switching, and increase system overhead, but it is conducive to short jobs that are too large to degenerate into FCFS-the time slice should be slightly larger than the time of a typical interaction.