CSCE 311 Fall 2017 Process Scheduling Name: Due: 1. Assume that the following pr
ID: 3585766 • Letter: C
Question
CSCE 311 Fall 2017 Process Scheduling Name: Due: 1. Assume that the following processes arrive at the times shown in the table below and with the indicated CPU burst. Process Arrival Time CPU Burst 13 17 16 14 P4 a) Assuming FCFS process scheduling, draw the Gant chart showing the order in which the processes exccute. b) Assuming non-preemptive SJF scheduling, draw the Gant chart showing the order in which the processes execute. c) Assuming SJR (preemptive SJF) scheduling, draw the Gant chart showing the order in which the processes execute. d) Assuming RR scheduling with quantum- 5, draw the Gant chart showing the order in which the processes exccute e) Assuming process priority Pl:1, P2:2, P3:3, P4:0, draw the Gant chart to show the priority scheduling for these processes. (smaller numberhigher priority) 2. What is the average waiting time for each of the scheduling algorithms in question 1? a) b) c) d) e)Explanation / Answer
1
a)
First-Come, First – Served (FCFS) Scheduling:
Process Arrival Time Burst Time
P1 3 13
P2 0 17
P3 4 16
P4 7 14
The processes arrive in the order P2, P1, P3, P4
The Gantt chart for the schedule is:
P2
P1
P3
P4
0 17 30 46 60
Waiting Time for P1 = 17, P2 = 0, P3 = 30, P4 = 46
2a)Average Waiting time: (17 + 0 + 30 + 46)/4 = 93/4 = 23.5
b)
Non-preemptive SJF scheduling:
Associate with each process the length of its next CPU burst.Use these lengths to schedule the process with the shortest time.
Non – preemptive: Once CPU given to the process it cannot be preempted until completes its CPU burst.
SJF(Non – Preemptive)
Gantt Chart:
P2
P1
P4
P3
0 17 30 44 60
2b)
Process
Wait Time
Turnaround Time
P2
0
17 – 0 = 17
P1
30 – 3 = 27
44 – 3 = 41
P4
17 – 7 = 10
30 – 7 = 23
P3
44 – 4 = 40
60 – 4 = 56
Total Wait Time
0 + 27 + 10 + 40 = 77
Average Waiting Time = (Total Wait Time)/(Total Number of processes)
77/4 = 18.5
Total Turn Around Time
17 + 41 + 23 + 56 = 137
Average Turn Around Time = (Total Turn Around Time)/(Total number of processes)
137/4 = 34.25
Throughput
4 jobs/ 77 = 0.0519 jobs/unit
1
a)
First-Come, First – Served (FCFS) Scheduling:
Process Arrival Time Burst Time
P1 3 13
P2 0 17
P3 4 16
P4 7 14
The processes arrive in the order P2, P1, P3, P4
The Gantt chart for the schedule is:
P2
P1
P3
P4
0 17 30 46 60
Waiting Time for P1 = 17, P2 = 0, P3 = 30, P4 = 46
Average Waiting time: (17 + 0 + 30 + 46)/4 = 93/4 = 23.5
Non-preemptive SJF scheduling:
Associate with each process the length of its next CPU burst.Use these lengths to schedule the process with the shortest time.
Non – preemptive: Once CPU given to the process it cannot be preempted until completes its CPU burst.
SJF(Non – Preemptive)
Gantt Chart:
P2
P1
P4
P3
0 17 30 44 60
Process
Wait Time
Turnaround Time
P2
0
17 – 0 = 17
P1
30 – 3 = 27
44 – 3 = 41
P4
17 – 7 = 10
30 – 7 = 23
P3
44 – 4 = 40
60 – 4 = 56
Total Wait Time
0 + 27 + 10 + 40 = 77
Average Waiting Time = (Total Wait Time)/(Total Number of processes)
77/4 = 18.5
Total Turn Around Time
17 + 41 + 23 + 56 = 137
Average Turn Around Time = (Total Turn Around Time)/(Total number of processes)
137/4 = 34.25
Throughput
4 jobs/ 77 = 0.0519 jobs/unit
P2
P1
P3
P4