What is a prediction How the OS scheduler can predict the CP
What is a prediction? How the OS scheduler can predict the CPU burst in Shortest-Job-First scheduling method?
Solution
Prediction:
 Prediction is a statement given about what will happen or might happen in future.
 There are different scheduling methods to predict a CPU burst and one of the best method is SJF
 Given below how OS scheduler can predict CPU burst by SJF Scheduling
 Shortest Job First(SJF) scheduling:
2
in SJF scheduling shortest path is first executed
 Hence the GANTT chart will be the following:
0 2 5 11 32
Now the average time will be=(0+2+5+11)/4=4.5ms
in preemptive SJF,jobs are put into ready queue when they arrived,but a process with shortest burst time arrives,
the existing process is preempited
hence the GANTT chart will be the following:
0 1 3 5 6 12 32
the average time will be: ((5-3)+(6-2)+12-1))/4=4.25ms
 the average waiting time for preemptive SJF is less than non preemptive SJF
| PROCESS | BURST TIME | 
|---|---|
| P1 | 21 | 
| P2 | 3 | 
| P3 | 6 | 
| P4 | 2 | 

