I'm familiar with Shortest Process next Scheduling Algorithm (SJF) which is a non preemptive algorithm. But, this algorithm handles only one process at a time which has the smallest burst time. Can it be modified as Shortest Process Next 2 at a time?
So for the example mentioned here:
5A 0 3B 2 6C 4 4D 6 5E 8 2
The first lines denotes the Total number of processes.The subsequent lines denotes the Process ID, Arrival Time, Burst Time.
The SJF scheduling with 2 processes at a time will works as follows :
Time | A | B | C | D | E | IDLE |------------------------------------------------ 0 | O | | | | | 1 | 1 | O | | | | | 1 | 2 | X | O | | | | | 3 | | O | | | | 1 | 4 | | O | O | | | | 5 | | O | O | | | | 6 | | O | O | | | | 7 | | X | X | | | | 8 | | | | O | O | | 9 | | | | O | X | | 10 | | | | O | | 1 | 11 | | | | O | | 1 | 12 | | | | X | | 1 |
Here,
O: Process scheduledX: Process completed
Idle denotes how many processors are currently idle. For this case, there are 2 processors.It can be observed that at time t=4
, there are 2 processes scheduled instead of 1.