15 Scheduling Basics II

15 Scheduling Basics II - CS-350: Fundamentals of Computing...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CS-350: Fundamentals of Computing Systems Page 1 of 10 Lecture Notes © Azer Bestavros. All rights reserved. Reproduction or copying (electronic or otherwise) is expressly forbidden except for students enrolled in CS-350. Resource Management Basics (continued) So far we have only examined one non-preemptive scheduler—namely FCFS—and we have noted that it was not “friendly” to short jobs. One approach we have considered to limit this unfriendliness was to resort to preemption. By preempting a long job (once it consumes its quantum) we were able to bound the waiting time for a short job arriving to the ready queue behind N other jobs to be N*Q (where Q is the quantum size). However, as we hinted before, there are resources that are not amenable to preemptive scheduling. Thus, we now consider non-preemptive schedulers that will do “better” than FCFS when it comes to protecting short jobs. Shortest Job Next: Scheduler Invocation: Non-Preemptive. The scheduler is invoked once the job currently holding the resource is finished. Selection Function: The shortest job from those available in the ready queue is selected. The Shortest Job Next (SJN), which is also known as Shortest Process Next (SPN), clearly (and explicitly) favors short jobs. It does not take into account the arrival time of a job. It bases its decision solely on the length of the job (i.e., the length of the CPU burst). Figure 1 Result of using a SJN scheduler on the example task set Figure 1 shows the result of using SJN to schedule the example task set. From that figure, we can see that the completion times for processes P1, P2, P5, P3, and P4 (which would have executed in that order) is given by 3, 9, 11, 15, and 20, respectively.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CS-350: Fundamentals of Computing Systems Page 2 of 10 Lecture Notes © Azer Bestavros. All rights reserved. Reproduction or copying (electronic or otherwise) is expressly forbidden except for students enrolled in CS-350. So, how good is SJN? Taking the arrival times of these tasks into consideration, we get the following turnaround times for the jobs from P1 through P5 to be 3-0=3, 9-2=7, 15-4=11, 20- 6=14, and 11-8=3. This results in an average turnaround time of 38/5=7.6. Comparing this average turnaround time to that of the FCFS scheduler, we note that it is smaller. Indeed, one can show that SJN is optimal amongst non-preemptive scheduler with respect to the average turnaround time. 1 More importantly, we note that the slowdown for short jobs (in particular that of the job belonging to P5) is smaller. For P5, the slowdown is 3/2=1.5, which is decisively better than that of FCFS (and indeed of all its preemptive derivatives, namely RR and VRR). As we hinted before, whenever we introduce priorities in a scheduler, we must worry about whether or not we may end up locking out one class of jobs from receiving service altogether!
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 04/14/2011.

Page1 / 10

15 Scheduling Basics II - CS-350: Fundamentals of Computing...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online