I am having a problem on how to sort the arrival time and burst time simultaneously. My code first checks the lower burst time and then checks the arrival time.
Shortest Job First (Non preemptive) CPU Scheduling checks the process burst time and
if it the Process
has the lowest Bursting Time and Arrival time then it will be executed.
Here's my snippet code for sorting the array:
inputs.sort((a1, a2) => (a1.burst < a2.burst) ? 1 : (a1.burst < a2.burst) ? 1 : -1);
and here's the result of the snippet code above:
This should be the output if the sorting formula is right:
Reference: Shortest Job First (SJF)