Process scheduling Calculation Law problem

Source: Internet
Author: User

With P1, P2, P3, and P4 a total of 4 processes go into the ready queue sequentially, they require processor time and priority levels as follows:

Process uses processor Time (seconds) Precedence number
P1 20 3
P2 30 5
P3 10 2
P4 5 4

to ignore the time it takes to schedule, answer the following questions:

(1) write out the order of process execution selected by the "first come first service" and "Non preemptive priority" scheduling algorithms.

(2) Under the above two algorithms, the waiting time and average wait time of each process in the ready queue are calculated separately.

Answer: (1) The scheduling algorithm of 4 processes is P1, P2, P3, P4.

The scheduling order of 4 processes is P2, P4, P1, P3 with the non-preemptive priority number scheduling algorithm.

(2) The waiting time of each process in the ready queue is as follows: The first-come-first service scheduling algorithm.

p1:0 sec

P2:0+20=20 sec

P3:0+20+30=50 sec

P4:0+20+30+10=60 sec

Average wait Time: (0+20+50+60)/4=32.5 sec

The waiting time of each process in the ready queue is based on the non-preemptive priority number scheduling algorithm;

P1:30+5=35 sec

p2:0 sec

P3:20+30+5=55 sec

P4:30 sec

Average wait Time: (35+0+55+30)/4=30 sec

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.