Several process scheduling algorithms for operating system

Source: Internet
Author: User


Process Status:

1. Wait state: Wait for an event to complete;

2. Ready state: Wait system allocating the processor for operation;

3. Operating State: Possession Processor is running .

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/82/C3/wKiom1dgFXfAp1jTAADZNXW9V4c251.png "title=" QQ picture 20160614223154.png "Width=" height= "248" border= "0" hspace= "0" vspace= "0" style= "width:300px;height:248px" alt= "Wkiom1dgfxfap1jtaadznxw9v4c251.png"/>

Running state → wait states are often caused by waiting for peripherals, waiting for resources such as main memory to be allocated or waiting for manual intervention.

wait state → Ready state is the waiting condition has been satisfied, just assigned to the processor can be Run .

Run state → Ready state is not due to its own reasons, but by external causes the process of running the processor to let go, this time becomes the ready state. For example, a time slice is exhausted, or a higher priority process is used to preempt the processor, and so on.

Ready state → run-state system Select a process in the ready queue to occupy the processor in a certain policy, and it becomes a running state



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

First, First come first service and short job (process) priority scheduling algorithm

fcfs ) scheduling algorithm is one of the simplest scheduling algorithms, The algorithm can be used for both job scheduling and process scheduling. fcfs algorithms are more advantageous for long jobs (processes), And not conducive to short-term operations (process). This algorithm is suitable for cpu busy job, but not conducive to 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.

Second, 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:

650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M02/82/C3/wKiom1dgFHbjnjTgAAAyD1Ck0qg616.jpg "style=" float: none; "title=" 34849_o.jpg "alt=" Wkiom1dgfhbjnjtgaaayd1ck0qg616.jpg "/>

650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M02/82/C1/wKioL1dgFYmwmooTAABFTXTJIUY449.jpg "style=" float: none; "title=" 34850_o.jpg "alt=" Wkiol1dgfymwmootaabftxtjiuy449.jpg "/>

Three, 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 multi-level 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) The scheduler dispatches the processes in the second queue only when the first queue is idle, and only if the 1 to (i-1) queue is empty . the process in the queue runs and performs the corresponding time slice rotation.

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.


This article is from the "Potato _" blog, please be sure to keep this source http://10738432.blog.51cto.com/10728432/1789340

Several process scheduling algorithms for operating system

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.