Operating System Concept

Only available on StudyMode
  • Topic: Kompakt, Kompakt albums, Total 2
  • Pages : 2 (676 words )
  • Download(s) : 91
  • Published : March 24, 2013
Open Document
Text Preview
Process| Arrival Time| Burst time| Priority |
P1| 0| 3| 3|
P2| 1| 6| 1|
P3| 3| 9| 3|
P4| 6| 1| 2|
P5| 10| 6| 4|
P6| 15| 7| 2|

For Shortest-Job-First without preemption: (ignore the priority column, given above, for this one, priority is used in the non-preemptive priority algorithm) Check the arrival times. P1 arrives at time = 0, and its burst time is time = 3, so P1 will complete its execution at time = 3, because it starts at time = 0 and its burst time is time = 3, it will create a total time = 0 + 3 = 3 (running total 1). In that time, if you look at the arrival times, in the arrival time column above, P2 arrives at time = 1, but P3 also arrives at time = 3, and by this time P1 has finished executing, so you look at both P2 and P3, and you start executing the process with the shorter burst time, which is P2 with a time = 6. So P2 will run until it has finished its execution, its burst time = 6. You add this burst time = 6 onto the total which was calculated above when P1 was executed (which was time = 3), so the new total is time = 3 + 6 = 9 (running total 2).

Now, with executing up to time = 9 so far, you look through the list of arrival times in the arrival column above, you will see that not only is P3 ready but a shorter job, P4, arrived while P2 was executing as well, so among the two waiting processes, P4 will be chosen as its burst time is less, P3's burst time = 9, whereas P4's burst time is only 1, this is why it is called shortest-Job-First scheduling algorithm, it looks at the arrival times, and compares the jobs it has waiting, and chooses the job with the shortest burst length. If you add P4's burst time to the running total (time = 9), the new total execution time is, time = 9 + 1 = 10 (running total 3).

If you look at the arrival times in the arrival column now, P5 arrives at time = 10 as well, so we must choose between the already waiting P3, and the newly arrived P5, by comparing their burst...
tracking img