1. Rotation scheduling
(1) Time slice rotation scheduling algorithm
The CPU time is divided into a period, each paragraph is a time slice, the process takes turns to use the time slice. As follows:
(2) Virtual rotation method
The time slice rotation scheduling algorithm is unfair to the IO-type process: For CPU-type processes, the process will always run out of time slices after the CPU time slice is obtained, but for IO type, it is often to wait for IO events after running a portion of the time slices, always using their own time slices. In order to solve this problem, a virtual rotation method is proposed, and the algorithm is as follows:
The idea of the virtual rotation scheduling algorithm is that the process runs out of time slices and returns to the ready queue, while the process waits for an event to abort the CPU, the process enters the secondary queue after the event that the process is waiting for, and the CPU first dispatches the process from the secondary queue and the process from the ready queue when the secondary queue is empty.
2. Highest priority scheduling
Select the highest-priority process to run, and you can use a number (precedence) to represent the process priority.
Typically:
(1) The system process priority is higher than the user process;
(2) The foreground process priority is higher than the background process;
(3) The operating system prefers the IO-type process.
There is a problem in the preemptive version of the algorithm: priority reversal. For a specific introduction to this question, see Baidu Encyclopedia priority Flip article.
3. Multilevel Feedback Queue
(1) Non-preemptive multi-level feedback queue scheduling algorithm
The algorithm is described as follows:
The way the process returns to its original first-level ready queue:
A. Back to the first team or the end of the team? If the team is back to the top, the system is more friendly to such processes;
B. When the process is dispatched to the CPU again, is it time to run out of the remaining slices? or reassign a full time slice? If a full time slice is reassigned, the system is more friendly to such processes .
(2) Preemptive multi-level feedback queue scheduling algorithm
Unlike the non-preemptive multilevel feedback queue scheduling algorithm, only about the non-preemptive multilevel feedback queue scheduling algorithm describes the red line of the point, instead of the following description, which becomes a preemptive multi-level feedback queue scheduling algorithm :
"The preempted process goes back to the end of the original level-ready queue" or the team head; When the preempted process is dispatched to the CPU again, it can be just the time remaining before the run is finished, or a full time slice can be reassigned.
The multilevel feedback queue scheduling algorithm is as follows:
4. Shortest process Priority
Consistent with the short job first algorithm in the batch processing system.
(Most of the content of this article is compiled from Coursera on the Chen Xiangqun of operating system principles, only a small number of their own explanations)
Scheduling algorithm used in interactive system