{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

15 Scheduling Basics II

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

Info icon This 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.
Image of page 1

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

View Full Document Right 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!
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern