Hy everyone. I'm trying to write the SJF (short job first) algorithm NON-PREEMPTIVE for scheduling processes in C. I want to implement an algorithm that orders some processes by the burst of the processes. I get in input a list of "n" processes where I have the id, arrival time, and burst time for each process. It seems pretty simple to order the processes just by order of the burst time, and this happens when I have the same arrival time, but what happens when the arrival time of the two processes is the same and meanwhile also the burst time is the same? In this case, I have to look at the process's id to get that order. What happens when I work with more processes with the same arrival? For instance, if I have two processes with the same arrival and two other processes with the same arrival and same burst time, how can I implement the final code? So how can I implement the code in the way that each possible case is considered? I need the main idea of how to manage to work with that because I tried to write different codes, but `I always get an error.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.