Presentation is loading. Please wait.

Presentation is loading. Please wait.

Scheduling Preemptive Policies

Similar presentations


Presentation on theme: "Scheduling Preemptive Policies"— Presentation transcript:

1 Scheduling Preemptive Policies
Non-Sized Based

2 Non-Size-Based Policies
Jobs in service can be interrupted, but job “priority” is not a function of its size However, it can be a function of its age Jobs resume service where they had stopped Sample policies PRIORITY, PS, Preemptive-LCFS, Foreground-Background (FB – job with smallest CPU age is served)

3 Limitations of Non-Size-Based Preemptive Policies
Preemption can mitigate the impact of long jobs, e.g., the PS policy allows every job to immediately receive service, but it does not eliminate it PS does not outperform FCFS for all arrival sequences Ex.: Two jobs of size 1 arrive at t = 0 E[T]FCFS = 1.5; E[T]PS = 2, E[Slowdown]FCFS = 1.5; E[Slowdown]PS = 2 (Slowdown = T/S) PS outperforms FCFS only when CG2 > 1 M/G/1/PS has same response time as M/M/1/FCFS

4 Properties of PS Scheduling
Under PS scheduling, the response time of a job is proportional to its size E[T(x)]PS = x/(1 – ρ), for job of size x Under preemptive PS scheduling, the slowdown of a job is constant, irrespective of its size E[Slowdown(x)]PS = 1/(1 – ρ), for job of size x E[Slowdown]PS = 1/(1 – ρ)

5 Preemptive Priority – (1)
Expected time in the system for priority k job has three components E[Sk]: Mean service time for priority k job Expected time to complete service of all jobs of priority 1 to k in the system upon new job arrival Expected service time for all jobs of priority 1 to k-1 that arrive while job of priority k is in the system Both (1) and (3) are known (3) = Σ{i=1 to k -1}E[T(k)]λiE[Si] = E[T(k)] Σ{i=1 to k -1}ρi We need to derive an expression for (2)

6 Preemptive Priority – (2)
(2) = Expected remaining work only from jobs of priority 1 to k = Total expected remaining work contributed only by arrivals from priority 1 to k The latter is independent of the scheduling discipline (all work-conserving policies have the same remaining work) (2) = E[TQ]FCFS with arrivals only from priority 1 to k So that

7 Preemptive Priority – (3)
Which finally gives Note that the first term is the same as the busy period started by a job of size E[Sk] for jobs of priority 1 to k–1 This is the job’s “residence” time, i.e., time in system once it starts service The second term is the job’s waiting time. It is similar to the response time for a priority k job in a non-preemptive priority system, except for the difference that the numerator now only accounts for the excess contributed by jobs in priority classes 1 to k

8 Preemptive LCFS – Properties
Under preemptive LCFS scheduling, the response time of a job is proportional to its size E[T(x)]PLCFS = x/(1 – ρ), for job of size x Under preemptive LCFS scheduling, the slowdown of a job is constant, irrespective of its size E[Slowdown(x)]PLCFS = 1/(1 – ρ), for job of size x E[Slowdown]PLCFS = 1/(1 – ρ)

9 Preemptive LCFS Once a job is interrupted it does not return to service until after all subsequent jobs have been served This is a period of duration equal to the duration of a busy period in an M/G/1 queue, i.e., E[S]/(1–ρ) For a job of size x, the expected number of service interruptions is simply λx. Hence E[Wasted-Time(x)] = E[# interruptions]E[Length of interruption] = λxE[S]/(1–ρ) = ρx/(1–ρ) E[T(x)] = x + E[Wasted-Time(x)] = x + ρx/(1–ρ) = x/(1–ρ) LCFS offers the same average performance as PS but with fewer preemptions

10 Foreground-Background Scheduling (FB)
Goal is to give some form of preference to small jobs when job sizes are highly variable We don’t know job sizes, but we can measure their age, and “old” jobs are more likely to be very large FB policy (a.k.a. Least-Attained-Service or LAS) Job with the lowest CPU age gets in service Jobs with the same lowest CPU age share the CPU using PS

11 Analyzing FB – (1) The response time for a (tagged) job of size x under FB has three components The size of the job, x The expected remaining work in the system when the job arrives, counting every job of size > x as having exactly size x The expected work from new arrivals while the job is in the system (new arrivals must again be counted only to the extent they impact the service of the tagged job Component (1) is obviously trivial. In approaching the derivations of (2) and (3) for a job of size x, we will transform all jobs of size > x into a job of size x Once a job of size > x receives x worth of service, it can never affect the service of a job of size x

12 Analyzing FB – (2) Because the remaining work in the system does not depend on the scheduling policy, (2) is the same as in an M/G/1/FCFS system (after transforming jobs of size > x into jobs of size x) (2) = E[TQ]M/G/1/FCFS = Similarly, for (3) we have (3) = E[# arrivals during T(x)]E[size of arrivals seen by job x] = This implies and therefore

13 Some Properties of FB For job size distributions with a decreasing failure rate (DFR) E[T]FB < E[T]PS For job size distributions with an increasing failure rate (IFR) E[T]FB > E[T]PS For job size distributions with constant failure rate, i.e., exponential E[T]FB = E[T]PS and E[Slowdown]FB < E[Slowdown]PS


Download ppt "Scheduling Preemptive Policies"

Similar presentations


Ads by Google