Process scheduling algorithm

Source: Internet
Author: User

Scheduling algorithm refers to the resource allocation algorithm according to the resource allocation policy of the system.


1. First come first service scheduling algorithm. First come first service (FCFS) scheduling algorithm is the simplest scheduling algorithm, which can be used for both job scheduling and process scheduling. The FCFS algorithm is advantageous for long jobs (processes) and is not conducive to short jobs (processes). This algorithm is suitable for the CPU busy job, but it is not conducive to the I/O busy type of job (process).

2. Short job (process) priority scheduling algorithm. The short job (process) Priority scheduling algorithm (SJ/PF) refers to the algorithm for scheduling short or short process priorities, which can be used for job scheduling and process scheduling. However, it is unfavorable to the long-term operation; The urgency of the operation (process) is not handled in time; the length of the job is only estimated.

Turnaround time = completion time-arrival time; Take ownership turnaround time = turnaround time/service time;The use of SJ (P) F algorithm, whether the average turnaround time or the average time to turn the cycle, there are more obvious improvements, especially for the short job D, the turnaround time from the original (with the FCFS algorithm) 11 down to 3, and the average time of the right turnaround is from 5.5 to 1.5. This shows that the SJF scheduling algorithm can effectively reduce the average waiting time of the job and improve the system throughput.   -Priority scheduling algorithm  -1) Non-preemptive priority algorithm-once the system has assigned the processor to the highest-priority process in the ready queue, the process continues until the process is completed or the processor is discarded by an event, allowing the system to assign the processor to another process with higher priority. This scheduling algorithm is mainly used in batch processing systems, and can also be applied to some real-time systems where real-time requirements are not stringent. -2) Preemptive priority scheduling algorithm (important)-The system assigns the processor to the process with the highest priority and makes it execute. However, during its execution, as long as another process of higher priority has arisen, the process scheduler immediately stops the execution of the current process and assigns the processor to the new priority process; Obviously, this preemptive priority scheduling algorithm can better meet the requirements of urgent operation, This is often used in demanding real-time systems, as well as in batch and timeshare systems where performance requirements are high.     time-slice-based rotation scheduling algorithm-1. Time slice Rotation Method-1) Basic principle-the system can respond to requests from all users within a given time. -2) The determination of the time slice size-a small time slice is good for short jobs, can be completed faster, but frequent interruptions, process context switching, thereby increasing the system overhead; Conversely, the time slice is too long, each process can be completed in a time slice, the algorithm will degenerate into the FCFS algorithm, Cannot meet the needs of interactive users. Therefore, to choose a suitable time slice, it is preferable that the time slice is slightly more than a typical time of almost the need. 2. Multilevel feedback queue scheduling algorithm (important)-Multilevel feedback queue scheduling algorithm You do not have to know in advance the execution time required for various processes, but also to meet the needs of various types of processes, so it is a well-known process scheduling algorithm. -The implementation process of the scheduling algorithm is as follows-(1) Multiple ready queues should be set and different priorities assigned to each queue-(2) When a new process enters memory, it is first placed at the end of the first queue, queued for dispatch by Fcfs Principle-(3) only when the first queue is idle The scheduler only dispatches the process running in the second queue; only if section 1~ ( I-1) When the queue is empty, the first IProcess running in queue-multilevel feedback queue scheduling algorithm has good performance, can meet the needs of various types of users-(1) terminal type Job user-(2) Short batch job user-(3) Long batch processing job user scheduling algorithm refers to: according to the system resource allocation policy defined by the resource allocation algorithm. 1. First come first serve

1. First come first service scheduling algorithm. First come first service (FCFS) scheduling algorithm is the simplest scheduling algorithm, which can be used for both job scheduling and process scheduling. The FCFS algorithm is advantageous for long jobs (processes) and is not conducive to short jobs (processes). This algorithm is suitable for the CPU busy job, but it is not conducive to the I/O busy type of job (process).

2. Short process priority scheduling algorithm

2. Short job (process) priority scheduling algorithm. The short job (process) Priority scheduling algorithm (SJ/PF) refers to the algorithm for scheduling short or short process priorities, which can be used for job scheduling and process scheduling. However, it is unfavorable to the long-term operation; The urgency of the operation (process) is not handled in time; the length of the job is only estimated.

3. High priority priority scheduling algorithm

1. The type of priority scheduling algorithm. The highest priority priority (FPF) scheduling algorithm is introduced in order to take care of the urgency operation and get it into the system. This algorithm is often used in batch processing system, as a job scheduling algorithm, also as a variety of operating system process scheduling, can also be used in real-time systems. When it is used for job scheduling, a number of the highest priority jobs in the fallback queue are loaded into memory. When it is used for process scheduling, the processor is assigned to the highest priority process in the ready queue, at which point the algorithm can be further divided into the following two kinds:
1) Non-preemptive priority algorithm
2) Preemptive priority scheduling algorithm (high-performance computer operating system)
2. Priority type. The core of the highest priority scheduling algorithm is whether it uses static or dynamic precedence, and how to determine the priority of a process.
3. High response ratio priority scheduling algorithm
In order to compensate for the shortage of the short job priority algorithm, we introduce dynamic priority, which increases the priority level of the job with the increase of the waiting time and the rate a. The law of priority change can be described as: priority = (wait time + request service time)/request service time; = (response time)/Request service time

4. Time-slice-based rotation scheduling algorithm

1. Time slice rotation method. The time slice rotation method is generally used for process scheduling, each scheduling, the CPU allocation of the first process, and make it a time slice execution.   When the time slice is run out, a clock interrupt request is made by a timer, and the process is stopped and sent to the end of the ready queue; 2. Multilevel feedback queue scheduling algorithm multilevel feedback queue scheduling algorithm without knowing the time required to execute various processes in advance, it is a well-known process scheduling algorithm. The implementation process is as follows:
1) Set up multiple ready queues and assign different priorities to each queue. The higher the priority queue, the smaller the execution time slice required for each process.
2) When a new process enters memory, it is first placed at the end of the first queue and queued for dispatch by the FCFS principle. If he can be completed in a time slice, he can evacuate; if not, go to the end of the second queue and wait for the same schedule ... So, when a long job (process) moves from the first queue to the nth queue (the last queue), it runs on the nth queue time slice.
3) only when the first queue is idle, the scheduler dispatches the processes in the second queue, and only if the 1th to (i-1) queue is empty, the process in queue I is scheduled to run and the corresponding time slice rotation is performed.
4) If the processor is processing a process in queue I and a new process enters a higher priority queue, the new queue seizes the running processor and places the running process at the end of queue I.

Process scheduling algorithm

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.