processcpujob-scheduling

CPU scheduling algorithms and arrival time


I was looking at the examples found on http://www.tutorialspoint.com/operating_system/os_process_scheduling_algorithms.htm

And there's something that just doesn't make sense about those examples. Take shortest-job-first for example. The premise is that you take the process with the least execution time and run that first.

The example runs p1 first and then p0. But WHY? At t = 0 the only process that exists in the queue is p0. Wouldn't that start running at t = 0, and then p1 would start at t = 6?

I've got the same issue with priority based scheduling.


Solution

  • you are right , since the process P0 has arrived at the queue at 0 sec and before P1 , it will start executing before P1 .

    Their answer would be correct if there was no arrival time for the corresponding process and in that case , it is considered that all the processes have reached at the queue at the same time .So, the process with shortest executing time will be executed by CPU first .