A common process-first scheduling algorithm

Source: Internet
Author: User

  • What is process scheduling and why is there a process scheduling algorithm

      Whether it is in Batch processing Systemor isTime Sharing System, the number of user processes is generally greater thanProcessorthe number, which will cause them to compete with each other for processors. In addition, the system process also needs to useProcessor. This requires the process scheduler according to a certain strategy, the dynamicProcessorassigned to a single in the Ready queue Process to enable it to execute.

    650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/82/A0/wKiom1ddFSOw3Vp0AAA_eabxEB8955.jpg-wh_500x0-wm_3 -wmp_4-s_1904043770.jpg "title=" 0.jpg "alt=" Wkiom1ddfsow3vp0aaa_eabxeb8955.jpg-wh_50 "/>


  • A common process scheduling algorithm

Advanced first-out algorithm

the algorithm always Processor assigned to the process that first enters the ready queue, once a process has been allocated to the processor, it continues to execute until the process is complete or blocked before releasing the processor.

For example, there are three processes P1, P2, and P3 successively ready Queue , they are 21, 6, and 3 units of time, respectively ,

Implementation of the situation such as:

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/82/9E/wKioL1ddF1rQ5uEIAACQTfGsk58622.jpg-wh_500x0-wm_3 -wmp_4-s_3924986489.jpg "title=" 3c6d55fbb2fb43166261670820a4462309f7d341.jpg "alt=" Wkiol1ddf1rq5ueiaacqtfgsk58622.jpg-wh_50 "/>

for P1, P2, P3 Turnaround Time is 21, 27, 30, the average turnaround time is 26.

It can be seen that the FIFO algorithm service quality is poor, easy to cause the job user dissatisfaction, often as an auxiliary scheduling algorithm .

Short Process First

CPU run-time priority Scheduling Algorithm (scbf--shortest CPU Burst first), the algorithm from the Ready Queue The Next "CPU execution period Shortest" process is selected and assigned Processor . For example, There are four processes P1, P2, P3, and P4 in the ready queue, with their next execution period being 16, 12, 4, and 3 units of time, with performance such as: P1, P2, P3, and P4 turnaround Time They were 35, 19, 7, 3, with an average turnaround time of 16. Although the algorithm can obtain better scheduling performance, it is difficult to know exactly the next CPU execution period, but can only be predicted according to the execution history of each process .

Rotation Method

The previous algorithms are mainly used for Batch processing System , cannot be used as Time Sharing System in the main Scheduling Algorithm , in the time-sharing system, all use Time Slice rotation law.

Simple rotation: The system queues up all the ready processes according to the FIFO rules, at a certain time interval Processor the processes that are assigned to the queue. In this way, all processes in the ready queue can be run with a processor for the time slice .

Multilevel Queue method: Divide all the processes in the system into classes, each class being one level.

Multilevel Feedback Queue

Multilevel Feedback Queue The way is to set up multiple ready queues in the system and give each queue a different priority.


This article from the "Learning Record" blog, reproduced please contact the author!

A common process-first 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.