Problem Statement 2
Problem Statement 2
Assumptions
For performance evaluation, it has been assumed that all the processes are having equal
priority in a single processor environment. The number of processes and their burst time are
known before submitting the process for the execution. The context switching overhead
incurred in switching from one to another has been considered zero. All processes are CPU
bound. No processes are I/O bound. The time quantum is taken in milliseconds (ms).
Experiments Performed
Three different cases have been taken for performance evaluation of our comparison between
SJF and RR scheduling algorithm. In the case 1, process arrival time is zero and CPU burst
time is in random order. In the case 2, process arrival time is zero and CPU burst time is in
decreasing order. In the case 3, process arrival time is zero and CPU burst time is in
increasing order.
Case 1: CPU burst time in random order- Lets consider five processes (P1,P2,P3,P4,P5)
with arrival time zero and burst time (12,53,36,23,60) as shown in table1. The time quantum
for RR is taken as 20. Table 2 shows the output and figure 1 shows the Gantt chart.
TABLE 1
PROCESS NO.
P1
P2
P3
P4
P5
ARRIVAL TIME
0
0
0
0
0
BURST TIME
12
53
36
23
60
TABLE 2
ALGORITHM
SJF
RR
P1(12)
0
AVG.WAITING TIME
48.4
87
P4(23)
12
P3(36)
35
AVG.TURNAROUND TIME
85.2
123.8
P2(53)
71
P5(60)
124
184
SJF
P1(12 P2(20 P3(20 P4(20 P5(20 P2(20 P3(16 P4(13 P5(20 P2(13
)
)
)
)
)
)
)
)
)
)
0
12
32
52
72
92
112
128
131
151
164
RR
P5(20
)
184
Case 2: CPU burst time in decreasing order- Lets consider five processes
(P1,P2,P3,P4,P5) with arrival time zero and burst time (12,53,36,23,60) as shown in table3.
The time quantum for RR is taken as 20. Table 5 shows the output and figure 2 shows the
Gantt chart.
TABLE 3
PROCESS NO.
P1
P2
P3
P4
P5
ARRIVAL TIME
0
0
0
0
0
BURST TIME
60
53
36
23
12
TABLE 4
ALGORITHM
SJF
RR
P1(12)
0
AVG.WAITING TIME
48.4
92.4
P4(23)
12
P3(36)
35
AVG.TURNAROUND TIME
85.2
129.2
P2(53)
71
P5(60)
124
184
SJF
P1(20) P2(20) P3(20) P4(20) P5(12) P1(20) P2(20) P3(16) P4(3)
P2(13)
184
20
40
60
80
92
112
132
148
P1(20
)
151 171
RR
Case 3: CPU burst time in increasing order- Lets consider five processes
(P1,P2,P3,P4,P5) with arrival time zero and burst time (12,53,36,23,60) as shown in table3.
The time quantum for RR is taken as 20. Table 5 shows the output and figure 2 shows the
Gantt chart.
TABLE 5
PROCESS NO.
P1
P2
P3
P4
P5
ARRIVAL TIME
0
0
0
0
0
TABLE 6
ALGORITHM
SJF
AVG.WAITING TIME
48.4
BURST TIME
12
23
36
53
11
AVG.TURNAROUND TIME
85.2
RR
P1(12)
0
71.8
P4(23)
12
P3(36)
35
108.6
P2(53)
71
P5(60)
124
184
SJF
P1(12) P2(20) P3(20) P4(20) P5(20) P2(3)
0
12
32
52
72
92
RR
P5(20)
184