A common scheduling algorithm

Source: Internet
Author: User

1. First come first service (FCFS) scheduling algorithm

1. It can be used for job scheduling, or for process scheduling.

2. It is a priority to consider the longest waiting time in the system for the job or process.

3. Do not take into account the duration of the job or process execution time.

principle: Each time you select a process from the process readiness queue for the longest waiting time (first come in), assign the processor to it, run it, run it up, or block, the process Scheduler assigns the processor to other processes.

Description: FCFS algorithm is seldom used as the main scheduling algorithm in single processor, but it is often used in combination with other scheduling algorithms to form a more efficient algorithm. GCA, you can set up multiple queues in the system by priority, one queue per priority, and the FCFS algorithm for each priority schedule. This is more efficient.

2. Shortest priority scheduling algorithm

1. It can be used for job scheduling, or for process scheduling.

2. It is a priority to consider the shortest job or process in the system.

3. The length of the job or process is measured by time.

principle: It selects several jobs or processes from the external memory job or process fallback that estimate the shortest running time, and moves them into memory run.

Disadvantages: 1. You must know the run time of the job.

2. The turnaround time for long-working operations is significantly increased.

3. The urgency of the operation was not considered at all.

3. Rotation (RR) scheduling algorithm

1. For time-sharing systems.

2. Let each program on the ready queue run only one time slice.

3. If there are n processes on the ready queue, each process can obtain approximately 1/n processor time.

principle: The system according to the FCFS policy, all processes into a queue, set a time interval (such as 30ms) that is to produce an interrupt, the process scheduler in the activation process, the completion of a schedule, the CPU allocated to the first process, so that it executes. When the time slice of the process is exhausted or the run is complete, the system is assigned to the new team head (or the newly arrived urgent program), which guarantees that all processes in the ready queue can get CPU execution once in a certain period of time.

process Switching time: 1. If a time slice has not finished running, the running program has completed, immediately activates the scheduler, removes it from the queue, runs in the process of Scheduling Queue Squadron first, and launches a new time slice.

2. After a time fragment is exhausted, the timer interrupt handler is activated. If the process has not finished running, the scheduler will send it to the end of the ready queue.

Special Note: the size of the time slice has a great impact on the performance of the system. The time slice is too short to be useful for short jobs because it can be done in the time slice. However, for long jobs, process calls and process context switches are frequently executed, increasing the overhead of the system. If the time slice is too long, in order for each process to be completed in a single time slice, it will degenerate into the FCFS algorithm, unable to meet the needs of short jobs and interactive users.

4. Priority scheduling algorithm

It is divided into non-preemptive priority scheduling algorithm and preemptive priority scheduling algorithm.

(1) non-preemptive priority scheduling algorithm

principle: Once the processor is assigned to the highest priority process in the ready queue, the process is executed until it is completed, or an event occurs in the process and the processor is discarded, the system can assign the processor to another process with the highest priority.

(2) preemptive priority scheduling algorithm

principle: The processor is assigned to the highest priority process so that it executes, but during execution, a higher priority process occurs, and the scheduling process assigns the processor to the new higher-priority process.

The key to the priority scheduling algorithm is how to prioritize processes and determine whether to use static or dynamic precedence.

The static priority is determined at the time the process is created, and remains the same during the run of the process.

A dynamic priority is a priority that is given to a process at the beginning of its creation, and then its value changes with the progress of the process or the increase in wait time.

5. Multilevel Feedback Queue scheduling algorithm

A better process scheduling algorithm is currently recognized.

(1) Set up multiple ready queues. Set up multiple ready queues in the system and give each queue a different priority.

(2) The FCFS algorithm is used for each queue. When the new process enters memory, it first puts it at the end of the first pair of columns and waits for dispatch by the FCFS algorithm principle.

(3) Scheduling according to the priority of the column.


Common scheduling algorithms

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.