59
DP-FAIR: A Simple Model for Understanding Optimal Multiprocessor Scheduling Greg Levin Shelby Funk Caitlin Sadowski Ian Pye Scott Brandt University of California University of Georgia Santa Cruz

DP-F AIR : A Simple Model for Understanding Optimal Multiprocessor Scheduling

  • Upload
    powa

  • View
    39

  • Download
    1

Embed Size (px)

DESCRIPTION

Greg Levin † Shelby Funk ‡ Caitlin Sadowski † Ian Pye † Scott Brandt † † University of California ‡ University of Georgia Santa Cruz Athens. DP-F AIR : A Simple Model for Understanding Optimal Multiprocessor Scheduling. - PowerPoint PPT Presentation

Citation preview

Page 1: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

DP-FAIR: A Simple Model for Understanding Optimal Multiprocessor Scheduling

Greg Levin† Shelby Funk‡ Caitlin Sadowski†

Ian Pye† Scott Brandt†

†University of California ‡University of GeorgiaSanta Cruz Athens

Page 2: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

Backstory

NQ-Fairby Shelby Funk (Rejected from RTSS)

SNSby Greg, Caitlin,

Ian, and Scott (Rejected from RTSS)

DP-Fair

Page 3: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

Multiprocessors

Most high-end computers today have multiple processors

In a busy computational environment, multiple processes compete for processor time More processors means more scheduling

complexity

Page 4: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

4

Real-Time Multiprocessor Scheduling Real-time tasks have workload deadlines

Hard real-time = “Meet all deadlines!”

Problem: Scheduling periodic, hard real-time tasks on multiprocessor systems. This is difficult.

Page 5: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

5

Real-Time Multiprocessor Scheduling

easy!!

Real-time tasks have workload deadlines

Hard real-time = “Meet all deadlines!”

Problem: Scheduling periodic, hard real-time tasks on multiprocessor systems. This is difficult.

Page 6: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

Taxonomy of Multiprocessor Scheduling Algorithms

UniprocessorAlgorithms

LLFEDF

PartitionedAlgorithms

GlobalizedUniprocessor

Algorithms

GlobalEDF

DedicatedGlobal

Algorithms

PartitionedEDF

OptimalAlgorithms

EKG

LLREF

pfair

Page 7: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

7

Partitioned Schedulers ≠ Optimal Example: 2 processors; 3 tasks, each with 2 units

of work required every 3 time units

Page 8: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

8

Global Schedulers SucceedExample: 2 processors; 3 tasks, each with 2 units

of work required every 3 time units

Task 3 migrates between processors

Page 9: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

9

Problem Model n tasks running on m processors

A periodic task T = (p, e) requires a workload e be completed within each period of length p

T's utilization u = e / p is the fraction of each period that the task must execute

job release

time = 0 p 2p 3p

job releasejob releasejob release

period p

workload e

Page 10: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

time

workcompleted

job release deadline

Fluid Rate Curve

period p

workload e

fluid rate curveutilization u =slope = e/p

actual work curveslope = 0 or 1

10

Page 11: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

job release deadline

Feasible Work Region

period p

workload e

zero

laxity

work completework

completed

time

11

CPU rate

= 1

Page 12: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

12

Assumptions Processor Identity: All processors are equivalent

Task Independence: Tasks are independent

Task Unity: Tasks run on one processor at a time

Task Migration: Tasks may run on different processors at different times

No overhead: free context switches and migrations In practice: built into WCET estimates

Page 13: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

13

The Big Goal (Version 1)

Design an optimal scheduling algorithm for periodic task sets on multiprocessors

A task set is feasible if there exists a schedule that meets all deadlines

A scheduling algorithm is optimal if it can

always schedule any feasible task set

Page 14: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

14

Necessary and Sufficient Conditions Any set of tasks needing at most

1) 1 processor for each task ( for all i, ui ≤ 1 ) , and

2) m processors for all tasks ( ui ≤ m)

is feasible Proof: Small scheduling intervals can approximate a

task's fluid rate curve

Status: Solved pfair (1996) was the first optimal algorithm

Page 15: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

15

The Big Goal (Version 2)

Design an optimal scheduling algorithm with fewer context switches and migrations ( Finding a feasible schedule with fewest

migrations is NP-Complete )

Page 16: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

16

The Big Goal (Version 2)

Design an optimal scheduling algorithm with fewer context switches and migrations

Status: Solved BUT, the solutions are complex and confusing

Our Contributions: A simple, unifying theory for optimal global multiprocessor scheduling and a simple optimal algorithm

Page 17: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

17

Greedy Algorithms Fail on Multiprocessors A Greedy Scheduling Algorithm will regularly

select the m “best” jobs and run those Earliest Deadline First (EDF) Least Laxity First (LLF)

EDF and LLF are optimal on a single processor ; neither is optimal on a multiprocessor Greedy approaches generally fail on multiprocessors

Page 18: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

18

Example (n = 3 tasks, m = 2 processors) :

Why Greedy Algorithms FailOn Multiprocessors

Page 19: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

19

Why Greedy Algorithms FailOn MultiprocessorsAt time t = 0, Tasks 1 and 2 are the obvious greedy choice

Page 20: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

20

Why Greedy Algorithms FailOn MultiprocessorsEven at t = 8, Tasks 1 and 2 are the only “reasonable” greedy choice

Page 21: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

21

Why Greedy Algorithms FailOn MultiprocessorsYet if Task 3 isn’t started by t = 8, the resultant idle time eventually causes a deadline miss

Page 22: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

22

Why Greedy Algorithms FailOn Multiprocessors

How can we “see” this critical event at t = 8?

Page 23: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

23

Proportioned AlgorithmsSucceed On Multiprocessors

Subdivide Task 3 with a period of 10

Page 24: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

24

Proportioned AlgorithmsSucceed On Multiprocessors

Now Task 3 has a zero laxity event at time t = 8

Page 25: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

25

Proportional Fairness

Insight: Scheduling is easier when all jobs have the same deadline

Application: Apply all deadlines to all jobs Assign workloads proportional to utilization Work complete matches fluid rate curve at

every system deadline

Page 26: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

26

Proportional Fairness Is the Key

All known optimal algorithms enforce proportional fairness at all deadlines: pfair (1996) - Baruah, Cohen, Plaxton, and Varvel

( proportional fairness at all times )

BF (2003) - Zhu, Mossé, and Melhem LLREF (2006) - Cho, Ravindran, Jensen EKG (2006) - Andersson, Tovar

Why do they all use proportional fairness?

Page 27: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

27

Scheduling Multiple Tasks is Complicated

time

workcompleted

Page 28: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

28

Scheduling Multiple Tasks with Same Deadline is Easy

workcompleted

time

Page 29: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

Actual Feasible Regions

29

workcompleted

time

job deadlines

Page 30: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

Restricted Feasible Regions Under Deadline Partitioning

30

workcompleted

time

all system deadlines

Page 31: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

31

The DP-Fair Scheduling Policy Partition time into slices based on all system deadlines

Allocate each job a per-slice workload equal to its utilization times the length of the slice

Schedule jobs within each slice in any way that obeys the following three rules:1. Always run a job with zero local laxity

2. Never run a job with no workload remaining in the slice

3. Do not voluntarily allow more idle processor time than

( m - ui ) x ( length of slice )

Page 32: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

time

DP-Fair Work Allocation

time slice

Allocatedworkload

slope = utilization

32

workcompleted

Page 33: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

DP-Fair Scheduling Rule #1

zero

local

laxity

line

When job hits zero local laxity, run to completion

33

time

workcompleted

time slice

Page 34: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

DP-Fair Scheduling Rule #2

time slice

local workcomplete

line

When job finishes local workload, stop running

34

time

workcompleted

Page 35: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

DP-Fair Scheduling Rule #3

time slice

Don’t voluntarily allow idle time in excess of this limit

slope = m - u i

slop

e =

m

Allowableidle time

35

time

idletime

Page 36: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

36

DF-Fair Guarantees Optimality We say that a scheduling algorithm is

DP-Fair if it follows these three rules

Theorem: Any DP-Fair scheduling algorithm for periodic tasks is optimal

Page 37: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

37

Proof of Theorem

Page 38: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

38

DP-Fair Implications

( Partition time into slices ) + ( Assign proportional workloads )

Optimal scheduling is almost trivial

Minimally restrictive rules allow great latitude for algorithm design and adaptability

What is the simplest possible algorithm?

Page 39: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

All time slices are equivalent (up to linear scaling), so normalize time slice length to 1 Jobs have workload = utilization

Schedule by “stacking and slicing” Line up job utilization blocks Slice at integer boundaries

39

The DP-Wrap Algorithm

Page 40: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

40

The DP-Wrap Algorithm

Example: 3 processors, 7 tasks

Page 41: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

41

The DP-Wrap Algorithm

Example: 3 processors, 7 tasks

Page 42: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

42

The DP-Wrap Algorithm

Example: 3 processors, 7 tasks

Page 43: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

43

The DP-Wrap Algorithm

Page 44: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

44

DP-Wrap Performance

n−1 context switches and m−1 migrations per time slice

This is about 1/3 as many as LLREF, similar to BF, and somewhat more than EKG

DP-Wrap has very low (O(n)) computational complexity

Page 45: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

45

Extending DP-Fair:Sporadic Arrivals, Arbitrary Deadlines

Sporadic arrivals: jobs from a task arrive at least p time units apart

Arbitrary deadlines: A job from T = (p, e, D) has a deadline D time units after arrival; D may be smaller or larger than p

DP-Fair and DP-Wrap are easily modified to handle these cases

Page 46: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

46

DP-Fair Easily Extended

Extending optimal algorithms to sporadic tasks and arbitrary deadlines has previously been difficult pfair : 10 years LLREF : 3 years

DP-Fair & DP-Wrap: 3 weeks

Page 47: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

Ongoing Work

Extend to uniform multiprocessors (CPUs running at different speeds)

Extend to random, unrelated job model Heuristic improvements to DP-Wrap

Work-conserving scheduling Slice merging

Page 48: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

48

Summary

DP-Fair : Simple rules to make optimal real-time multiprocessor scheduling easy!!

DP-Wrap : Simplest known optimal multiprocessor scheduling algorithm

Extensible : DP-Fair and DP-Wrap easily handle sporadic tasks with arbitrary deadlines We plan to extend DP-Fair and DP-Wrap to more

general problem domains

Page 49: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

49

Thanks for Listening Questions?

Page 50: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

50

=== EXTRA SLIDES ===

1. Sporadic Tasks, Arbitrary Deadlines

Page 51: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

51

Sporadic Arrivals, Arbitrary Deadlines We extend our task definition to Ti = (pi, ei, Di) ,

where each job of Ti has a deadline Di time units after its arrival; Di may be smaller or larger than pi. These are referred to as arbitrary deadlines.

Sporadic arrivals means that pi is now the minimum inter-arrival time for Ti's jobs, so that a new job will arrive at least pi time units after the previous arrival. Scheduling is on-line, i.e. we don't know ahead of time

when new jobs will arrive

Page 52: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

52

Task Density

Our expression for utilization must be updated to the density of a task:

i = ei / min{ pi , Di } and are still

sufficient conditions for the feasibility of a task set, but they are no longer necessary. Example: T1 = (2, 1, 1) , T2 = (2, 1, 2) on m =

1 is feasible, although = 1.5.

Page 53: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

53

Optimality Our updated DP-Fair rules for sporadic tasks with

arbitrary deadlines will allow an algorithm to schedule any task set with and

; in fact, we require that these conditions hold

Since feasible task sets exist where these conditions do not hold, DP-Fair algorithms are not optimal in this problem domain

This is an acceptable limitation, since it has recently been proven that no optimal scheduler can exist for sporadic tasks

Page 54: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

54

Updated DP-Fair Scheduling

The rules for scheduling within time slices is nearly the same with sporadic tasks and arbitrary deadlines

The third rule is now:

"Do not voluntarily allow more than units of idle time to occur during the time slice before time t"

The Fj (t) term represents unused capacity between tasks' deadlines and next arrivals

Page 55: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

55

Updated DP-Fair Allocation The rules for allocating workloads in time slices

become more complicated than simple proportionality

A task is active between its arrival and its deadline. When a task becomes active, it is allocated a workload proportional to its density and the length of its active segment in the slice

If a job arrives during a slice that will have a deadline within the slice, the remainder of the slice is partitioned into two new subslices, with a subslice boundary at the deadline, and remaining work for all tasks allocated proportionally to subslice lengths

Page 56: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

Handling a Sporadic Arrival

time slice

Workloadallocatedupon arrival

Sporadic arrival in the middle of a slice

56

time

workcompleted

Page 57: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

Managing Idle Time

time slice

Available idle time grows by utilization of unarrived sporadic job…

slope = m - u i

slop

e =

m

Original idle time pool

…until that job finally arrives

Additional idle time from late arrival

57

time

idletime

Page 58: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

58

Theorem 3 Any DP-Fair scheduling algorithm for

sporadic tasks with arbitrary deadlines will successfully schedule any task set where

and

Page 59: DP-F AIR : A Simple Model    for Understanding Optimal Multiprocessor Scheduling

59

Modifying DP-Wrap

The DP-Wrap algorithm is easily modified to accommodate the DP-Fair scheduling rules for sporadic tasks with arbitrary deadlines

If a job arrives during a time slice, wrap it onto the end of the stack of blocks

If the arriving job has a deadline within the current slice, partition the remainder of the slice into two subslices, as per our previous rule, and apply the usual scheduling rules to both of these subslices