SJf and FCFS will perform similarly as far as average waiting time is concerned if all processes have the same CPU burst time or the ones with the shorter CPU burst time arrive first.
SJF will do significantly better than FCFS when the processes have very different CPU burst times and the ones with longer bursts arrive first and the one with shorted burst time arrive in the ready queue before these longer ones have executed.
| Group Information for 3 Groups | |||||
| Name | Commentary | Duration | CPU Burst | I/O Burst | Priority | part2b_group_1 | Group 1 from run part2b | constant 1000.00 | constant 100.00 | constant 800.00 | 1.00 | part2c_group_1 | Group 1 from run part2c | constant 1000.00 | constant 100.00 | constant 800.00 | 1.00 | part2c_group_2 | Group 2 from run part2c | constant 100.00 | constant 10.00 | constant 80.00 | 1.00 |
| Creator Information for 2 Creators | ||||||
| Name | Commentary | Seed | Group | Processes | First Arrival | Interarrival |
| part2b_creator | Creator from run part2b | 123456 | part2b_group_1 | 10 | 0.0 | constant 0.00 |
| part2c_creator | Creator from run part2c | 123456 | part2c_group_1 | 10 | 0.0 | constant 0.00 |
| part2c_group_2 | 10 | 0.0 | constant 0.00 | |||
| Experimental Run Information for 2 Runs | ||||
| Name | Commentary | Creator | Algorithm | Key | part2b | Two types of processes | part2b_creator | FCFS | part2c | Two types of processes | part2c_creator | FCFS |
| Experimental Runs For 2 Experiments | |||
| Experiment | Commentary | Run | Modifications |
| part2b | Two runs with different algorithms | part2b_1 | key First-Come, First-Served |
| part2b_2 | algorithm SJF | ||
| key Shortest Job First | |||
| part2c | Two runs with different algorithms | part2c_3 | key First-Come, First-Served |
| part2c_4 | algorithm SJF | ||
| key Shortest Job First | |||
| Experimental Run Information | ||||
| Name | Commentary | Creator | Algorithm | Key | part2b_1 | Two types of processes | part2b_creator | FCFS |
| Experimental Run Information | ||||
| Name | Commentary | Creator | Algorithm | Key | part2b_2 | Two types of processes | part2b_creator | SJF |
| Description | Algorithm | Time | Processes | Finished | CPU Utilization | Throughput | Turnaround Time | Waiting Time | part2b_1 | FCFS | 10000.00 | 10 | 10 | 1.00000 | .001000 | 9550.00 | 1350.00 | part2b_2 | SJF | 10000.00 | 10 | 10 | 1.00000 | .001000 | 9550.00 | 1350.00 |
| Turnaround Time | Waiting Time | ||||||||
| Description | Algorithm | Average | Minimum | Maximum | SD | Average | Minimum | Maximum | SD | part2b_1 | FCFS | 9550.00 | 9100.00 | 10000.00 | 287.23 | 1350.00 | 900.00 | 1800.00 | 28.72 | part2b_2 | SJF | 9550.00 | 9100.00 | 10000.00 | 287.23 | 1350.00 | 900.00 | 1800.00 | 28.72 |
In this first experiment, all process have the same constant CPU burst time of 100 and a duration of 1000. Each process executes exactly 10 CPU bursts. Since all bursts are the same, SJF and FCFS give exactly identical results.
| Experimental Run Information | ||||
| Name | Commentary | Creator | Algorithm | Key | part2c_3 | Two types of processes | part2c_creator | FCFS |
| Experimental Run Information | ||||
| Name | Commentary | Creator | Algorithm | Key | part2c_4 | Two types of processes | part2c_creator | SJF |
| Description | Algorithm | Time | Processes | Finished | CPU Utilization | Throughput | Turnaround Time | Waiting Time | part2c_3 | FCFS | 11000.00 | 20 | 20 | 1.00000 | .001818 | 7992.50 | 3482.50 | part2c_4 | SJF | 11000.00 | 20 | 20 | 1.00000 | .001818 | 5802.50 | 1292.50 |
| Turnaround Time | Waiting Time | ||||||||
| Description | Algorithm | Average | Minimum | Maximum | SD | Average | Minimum | Maximum | SD | part2c_3 | FCFS | 7992.50 | 5210.00 | 11000.00 | 2566.16 | 3482.50 | 1900.00 | 4680.00 | 57.60 | part2c_4 | SJF | 5802.50 | 1010.00 | 11000.00 | 4751.89 | 1292.50 | 190.00 | 2800.00 | 53.85 |
In this second experiment there are two sets of 10 processes. Each process in the first set executes 10 CPU bursts of length 100 and each process in the second set executes 10 CPU bursts of length 10.
Unser FCFS, the long processes execute first and all of the short processes have to wait until the long processes have executed their first CPU bursts. When the short processes enter the ready queue again they sometimes also have to wait for at least some of the long processes. This can easily be seen by the amount of green in the second set of processes in the first Gantt chart.
Under SJF, these short processes only have to wait for each other except for the first long process which starts immediately when it arrives. Other than that, these short processes spend very little time in the ready queue. The short jobs leave the system quickly and the long jobs also do very little waiting after the short jobs have finished.
The average waiting time under SJF is much smaller than for FCFS in this example.