Solve SJFNONPREMPTIVE for the following process and calculat
Solve SJF(NON-PREMPTIVE) for the following process and calculate :
Please show work so I can understand this.
U (CPU utilization),
WT (waiting times)
TT (turnaround times),
RT(response times)
AVG WT (avg waiting times)
AVG TT (avg turnaround times),
AVG RT(avg response times)
Process Data:
process goes {CPU burst, I/O time, CPU burst, I/O time, CPU burst, I/O time,…….., last CPU burst}
P1 {4,24,5,73,3,31,5,27,4,33,6,43,4,64,5,19,2}
P2 {18,31,19,35,11,42,18,43,19,47,18,43,17,51,19,32,10}
P3 {6,18,4,21,7,19,4,16,5,29,7,21,8,22,6,24,5}
P4 {17,42,19,55,20,54,17,52,15,67,12,72,15,66,14}
P5 {5,81,4,82,5,71,3,61,5,62,4,51,3,77,4,61,3,42,5}
P6 {10,35,12,41,14,33,11,32,15,41,13,29,11}
P7 {21,51,23,53,24,61,22,31,21,43,20}
P8 {11,52,14,42,15,31,17,21,16,43,12,31,13,32,15}
Solution
The CPU Burst times for all processes are as under
process Burst Time
P1 38 {4+5+3+5+4+6+4+5+2}
P2 149 {18+19+11+18+19+18+17+19+10}
P3 52 {6+4+7+4+5+7+8+6+5}
P4 129 {17+19+20+17+15+12+15+14}
P5 41 {5+4+5+3+5+4+3+4 +3+5}
P6 86 {10+12+14++11+15+13+11}
P7 131 {21+23+24+22+21+20}
P8 113 {11+14+15++17+16+12++13+15}
Gantt Chart
| P1 | P5 | P3 | P6 | P8 | P4 | P7 | P2 |
0 38 79 131 217 330 459 590 739
Average Waiting Time = ((0)+(38)+(79) +(131)+(217)+(330)+(459)+(590)+14cs)/8 = 232.25 ms
where cs is context switch for 8 processes. (7*2=14 cs)
Average Response time is same as waiting time in nonpreemptive SJF = 232.25ms
Average Turnaround time = (38+79+131+217+330+459+590+739+14cs)/8 = 324.625 ms
CPU utilization = 739/(739+7cs) = 0.99
cs is ignored

