CSC520 - Chapter 4 Exercise Solutions
CSC520 - Chapter 4 Exercise Solutions
Suppose a system uses priority scheduling where a small integer means higher priority
Create a Gantt chart to illustrate the execution of these processes What is the turnaround time for process P2 under priority scheduling? What is the average waiting time for the processes?
P1 0 20
P4 70
P0
P2 150 160
P3 180
Exercise
Based on the information given below, draw a Gantt chart illustrating the execution of each process using the following algorithms
SJN RR (Quantum = 2)
Calculate the response time for process A and process E, for each of the algorithm
A
0 8
C
11
B
15 18
D
20
F
23
E
27
A
0 6
B
8
A
10 12
B
14
C
15 18
D
20
E
22
F
24
E
26
F
27
RR Response Time
PA 0 PE 1
Exercise
Suppose a system uses SJN scheduling where a small integer means higher priority
Create a Gantt chart to illustrate the execution of these processes What is the turnaround time for process P3 under SJN scheduling? What is the average waiting time for the processes?
P0
0
P3
75 95
P2
120
P1
160
P4
205
P3 Turnaround time
95 55 = 40
Waiting Time
P0 0 P1 150 P2 85 P3 20 P4 65
Exercise
Based on the information given below, draw a Gantt chart illustrating the execution of each process using the following algorithms
FCFS SJF Priority Scheduling
Calculate the waiting time for Process B and D for each of the scheduling algorithm
A
0
B
10 12
C
15
D
20
A
0
B
10 12
C
15
D
20
A
0 10
D
15
B
17
C
20
Exercise
Based on the information given below, draw a Gantt chart illustrating the execution of each process using the priority scheduling algorithm Calculate the average turnaround time for all processes Calculate the average waiting time for all processes
P0
0 20
P1
55
P2
75
P3
90
P4
115
Exercise
Suppose a system uses RR (q =15) scheduling where a small integer means higher priority
Create a Gantt chart to illustrate the execution of these processes What is the turnaround time for process P2 under RR scheduling? What is the average waiting time for the processes?
P0
0 15
P1
30
P2
40
P0
55
P1
60
P3
75
P4
90
P0
P3
105 110
P4
125
P0
140
P4
140
155
P0
P4 P0
170 175
180