I understand how shortest job first (non preemptive) scheduling works. Basically, when the CPU finish the current job it will select the shortest job in the queue to execute next.
This is an example I found online.
I'm trying to understand what this example would be like if it is for SJF with future prediction. There are a lot of examples for how to compute the next prediction [example]. But I can't find an example that illustrate how the predicted CPU burst time will be used to select the next job to execute.
Say Tn is the predicted burst time for the nth job. tn is the actual burst time. The initial prediction T1 = 5, a = 0.5.
Using the above example, P1 is the first job, so CPU will pick up immediately. But when P2 arrives at 2, how do we calculate T2?
Is it T2 = 0.5 * T1 + 0.5 * t1? But at 2, P1 hasn't finished, how do we know the actual burst time t1 for P1?
Edit: Like @Zain Arshad mentioned, T2 can be calculated when P1 finishes at 7. But at 7, both P2 and P3 have arrived. So T2 = 0.5 * T1 + 0.5 * t1 and T3 = 0.5 * T1 + 0.5 * t1? Then which of P2 and P3 to execute next?
Or my understanding has fundamental problem?