Uniprocessor Scheduling III CPSC 410 Operating Systems Department

  • Slides: 20
Download presentation
Uniprocessor Scheduling III CPSC 410 Operating Systems Department of Physics, Computer Science and Engineering

Uniprocessor Scheduling III CPSC 410 Operating Systems Department of Physics, Computer Science and Engineering Christopher Newport University

Question (1) z Consider the following set of processes: Process Name Arrival Time Processing

Question (1) z Consider the following set of processes: Process Name Arrival Time Processing Time 1 0 2 2 1 4 3 2 8 4 3 6 Perform the analysis of a comparison of scheduling policies: FCFS, RR(q=1), RR(q=4), SPN, SRT, HRRN, Feedback(q=1), and Feedback(q=2 i).

0 P 1 P 2 P 3 P 4 1 2 3 4 5

0 P 1 P 2 P 3 P 4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

Solution of Question 3 - FCFS (3) 0 0 0 0 0 1 1

Solution of Question 3 - FCFS (3) 0 0 0 0 0 1 1 1 1 1 2 0 1 2 3 4 5 6 7 8 9 0 * Each square represents one time unit. The number refers to the running process First Come First Served (FCFS) Process Pi 1 2 3 4 Arrival Time Ta 0 1 2 3 Service Time Ts 2 4 8 6 Finish Time Tf Turnaround Time Tq Tq = Tf - Ta Normalized Tq/Ts Turnaround Time Average

0 P 1 P 2 P 3 P 4 1 2 3 4 5

0 P 1 P 2 P 3 P 4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

Solution of Question 3 – RR (q=1) (5) 0 0 0 0 0 1

Solution of Question 3 – RR (q=1) (5) 0 0 0 0 0 1 1 1 1 1 2 0 1 2 3 4 5 6 7 8 9 0 * Each square represents one time unit. The number refers to the running process Round Robin (RR q=1) Process Pi 1 2 3 Arrival Time Ta 0 1 2 Service Time Ts 2 4 8 Finish Time Tf Turnaround Time Tq Tq = Tf - Ta Normalized Tq/Ts Turnaround Time 4 3 6 Average

0 P 1 P 2 P 3 P 4 1 2 3 4 5

0 P 1 P 2 P 3 P 4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

Solution of Question 3 – RR (q=4) (7) 0 0 0 0 0 1

Solution of Question 3 – RR (q=4) (7) 0 0 0 0 0 1 1 1 1 1 2 0 1 2 3 4 5 6 7 8 9 0 * Each square represents one time unit. The number refers to the running process Round Robin (RR q=4) Process Pi 1 2 3 Arrival Time Ta 0 1 2 Service Time Ts 2 4 8 Finish Time Tf Turnaround Time Tq Tq = Tf - Ta Normalized Tq/Ts Turnaround Time 4 3 6 Average

0 P 1 P 2 P 3 P 4 1 2 3 4 5

0 P 1 P 2 P 3 P 4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

Solution of Question 3 - SPN (9) 0 0 0 0 0 1 1

Solution of Question 3 - SPN (9) 0 0 0 0 0 1 1 1 1 1 2 0 1 2 3 4 5 6 7 8 9 0 * Each square represents one time unit. The number refers to the running process Shortest Process Next (SPN) Process Pi 1 2 3 4 Arrival Time Ta 0 1 2 3 Service Time Ts 2 4 8 6 Finish Time Tf Turnaround Time Tq Tq = Tf - Ta Normalized Tq/Ts Turnaround Time Average

0 P 1 P 2 P 3 P 4 1 2 3 4 5

0 P 1 P 2 P 3 P 4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

Solution of Question 3 - SRT (11) 0 0 0 0 0 1 1

Solution of Question 3 - SRT (11) 0 0 0 0 0 1 1 1 1 1 2 0 1 2 3 4 5 6 7 8 9 0 * Each square represents one time unit. The number refers to the running process Shortest Remaining Time (SRT) Process Pi 1 2 3 4 Arrival Time Ta 0 1 2 3 Service Time Ts 2 4 8 6 Finish Time Tf Turnaround Time Tq Tq = Tf - Ta Normalized Tq/Ts Turnaround Time Average

0 P 1 P 2 P 3 P 4 1 2 3 4 5

0 P 1 P 2 P 3 P 4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

Solution of Question 3 - HRRN (13) 0 0 0 0 0 1 1

Solution of Question 3 - HRRN (13) 0 0 0 0 0 1 1 1 1 1 2 0 1 2 3 4 5 6 7 8 9 0 * Each square represents one time unit. The number refers to the running process Highest Response Ratio Next (HRRN) Process Pi 1 2 3 4 Average Arrival Time Ta 0 1 2 3 Service Time Ts 2 4 8 6 Finish Time Tf Turnaround Time Tq Tq = Tf - Ta Normalized Tq/Ts Turnaround Time

0 P 1 P 2 P 3 P 4 1 2 3 4 5

0 P 1 P 2 P 3 P 4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

Solution of Question 3 – FB q=1 (15) 0 0 0 0 0 1

Solution of Question 3 – FB q=1 (15) 0 0 0 0 0 1 1 1 1 1 2 0 1 2 3 4 5 6 7 8 9 0 * Each square represents one time unit. The number refers to the running process Feedback (FB q=1) Process Pi 1 2 Arrival Time Ta 0 1 Service Time Ts 2 4 Finish Time Tf Turnaround Time Tq Tq = Tf - Ta Normalized Tq/Ts Turnaround Time 3 2 8 4 3 6 Average

0 P 1 P 2 P 3 P 4 1 2 3 4 5

0 P 1 P 2 P 3 P 4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

Solution of Question 3 – FB q=2 i (17) 0 0 0 0 0

Solution of Question 3 – FB q=2 i (17) 0 0 0 0 0 1 1 1 1 1 2 0 1 2 3 4 5 6 7 8 9 0 * Each square represents one time unit. The number refers to the running process Feedback (FB q=2 i) Process Pi 1 2 Arrival Time Ta 0 1 Service Time Ts 2 4 Finish Time Tf Turnaround Time Tq Tq = Tf - Ta Normalized Tq/Ts Turnaround Time 3 2 8 4 3 6 Average

Question 2 - Exercise/Home Work (1) Five batch jobs, A through E, arrive at

Question 2 - Exercise/Home Work (1) Five batch jobs, A through E, arrive at a computer center at essentially the same time. They have an estimated running time of 15, 9, 3, 6, and 12 minutes, respectively. Their (externally defined) priorities are 4, 7, 3, 1, and 6, respectively, with 10 being the highest priority. For each of the following scheduling algorithms, determine the turnaround time for each process and the average turnaround for all job. Ignore process switching overhead. In the last three cases, assume that only one job at a time runs until it finishes and that all jobs are completely processor-bound. (a) priority scheduling (b) FCFS (run in order 15, 9, 3, 6, and 12) (c) shortest job first.