real-time scheduling - penn engineeringlee/10cis541/papers/... · 2010. 1. 15. · real-time...

42
1 Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task invocations, release/arrival time, absolute deadline, relative deadline, period, start time, finish time, … Preemptive versus non-preemptive scheduling Priority-based scheduling Static versus dynamic priorities Utilization (U) and Schedulability Main problem: Find Bound for scheduling policy such that U < Bound All deadlines met! Optimality of EDF scheduling Bound EDF = 100%

Upload: others

Post on 02-Jan-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

1

Real-Time Scheduling

Introduction to Real-Time

Review

� Main vocabulary� Definitions of tasks, task invocations, release/arrival time,

absolute deadline, relative deadline, period, start time, finishtime, …

� Preemptive versus non-preemptive scheduling

� Priority-based scheduling

� Static versus dynamic priorities

� Utilization (U) and Schedulability� Main problem: Find Bound for scheduling policy such that

U < Bound � All deadlines met!

� Optimality of EDF scheduling� BoundEDF = 100%

Page 2: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

2

Schedulability Analysis of Periodic Tasks

� Main problem:� Given a set of periodic tasks, can they meet their deadlines?

� Depends on scheduling policy

� Solution approaches� Utilization bounds (Simplest)

� Exact analysis (NP-Hard)

� Heuristics

� Two most important scheduling policies� Earliest deadline first (Dynamic)

� Rate monotonic (Static)

Schedulability Analysis of Periodic Tasks

� Main problem:� Given a set of periodic tasks, can they meet their deadlines?

� Depends on scheduling policy

� Solution approaches� Utilization bounds (Simplest)

� Exact analysis (NP-Hard)

� Heuristics

� Two most important scheduling policies� Earliest deadline first (Dynamic)

� Rate monotonic (Static)

Page 3: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

3

Utilization Bounds

� Intuitively:

� The lower the processor utilization, U, the easier it is to meet deadlines.

� The higher the processor utilization, U, the more difficult it is to meet deadlines.

� Question: is there a threshold Ubound such that

� When U < Ubound deadlines are met

� When U > Ubound deadlines are missed

Example (Rate-Monotonic Scheduling)

Task 1P1=2

C1=1

Task 2P2=3C2=1.01

%3.833

01.1

2

1

2

2

1

1 ≈+=+=P

C

P

CU

0 1 2 3 4 5 6 time

?

100%

0

U

� Question: is there a threshold Ubound such that� When U < Ubound deadlines are met

� When U > Ubound deadlines are missed

Page 4: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

4

Example(Rate-Monotonic Scheduling)

Task 1P1=2

C1=1

Task 2P2=3C2=1.01

%3.833

01.1

2

1

2

2

1

1 ≈+=+=P

C

P

CU

0 1 2 3 4 5 6 time

?

100%

0

U

� Question: is there a threshold Ubound such that� When U < Ubound deadlines are met

� When U > Ubound deadlines are missed

Example(Rate-Monotonic Scheduling)

Task 1P1=2

C1=1

Task 2P2=3C2=1.01

%3.833

01.1

2

1

2

2

1

1 ≈+=+=P

C

P

CU

0 1 2 3 4 5 6 time

Missed deadline!

Unschedulable

?

100%

0

U

83.3%

� Question: is there a threshold Ubound such that� When U < Ubound deadlines are met

� When U > Ubound deadlines are missed

Page 5: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

5

Another Example(Rate-Monotonic Scheduling)

Task 1P1=2

C1=1

Task 2P2=6C2=2.4

%906

4.2

2

1

2

2

1

1 =+=+=P

C

P

CU

0 1 2 3 4 5 6 time

?

100%

0

U

83.3%

� Question: is there a threshold Ubound such that� When U < Ubound deadlines are met

� When U > Ubound deadlines are missed

Another Example(Rate-Monotonic Scheduling)

Task 1P1=2

C1=1

Task 2P2=6C2=2.4

%906

4.2

2

1

2

2

1

1 =+=+=P

C

P

CU

0 1 2 3 4 5 6 time

?

100%

0

U

83.3%

� Question: is there a threshold Ubound such that� When U < Ubound deadlines are met

� When U > Ubound deadlines are missed

Page 6: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

6

Another Example(Rate-Monotonic Scheduling)

Task 1P1=2

C1=1

Task 2P2=6C2=2.4

%906

4.2

2

1

2

2

1

1 =+=+=P

C

P

CU

0 1 2 3 4 5 6 time

Schedulable!

?

100%

0

U

83.3%90%

� Question: is there a threshold Ubound such that� When U < Ubound deadlines are met

� When U > Ubound deadlines are missed

Another Example(Rate-Monotonic Scheduling)

Task 1P1=2

C1=1

Task 2P2=6C2=2.4

%906

4.2

2

1

2

2

1

1 =+=+=P

C

P

CU

0 1 2 3 4 5 6 time

Schedulable!

?

100%

0

U

83.3%90%

� Question: is there a threshold Ubound such that� When U < Ubound deadlines are met

� When U > Ubound deadlines are missed

Schedulability depends on task set!No clean utilization threshold between schedulable and unschedulable

task sets!

Page 7: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

7

A Conceptual View of Schedulability

Utilization

Task Set

SchedulableUnschedulable

� Question: is there a threshold Ubound such that� When U < Ubound deadlines are met

� When U > Ubound deadlines are missed

∑=i i

i

P

C

A Conceptual View of Schedulability

Utilization

Task Set

SchedulableUnschedulable

� Modified Question: is there a threshold Ubound such that� When U < Ubound deadlines are met

� When U > Ubound deadlines may or may not be missed

?

All green area (sche

dulable)

∑=i i

i

P

C

Page 8: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

8

A Conceptual View of Schedulability

Utilization

Task Set

SchedulableUnschedulable

� Modified Question: is there a threshold Ubound such that� When U < Ubound deadlines are met

� When U > Ubound deadlines may or may not be missed

?

All green area (sche

dulable)

U < Ubound is a sufficient but not necessaryschedulabilitycondition

∑=i i

i

P

C

A Conceptual View of Schedulability

Utilization

Task Set

SchedulableUnschedulable

� Modified Question: is there a threshold Ubound such that� When U < Ubound deadlines are met

� When U > Ubound deadlines may or may not be missed

?

All green area (sche

dulable)

Equivalent question:What’s the lowest utilization of an unschedulable task set?

∑=i i

i

P

C

Page 9: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

9

A Conceptual View of Schedulability

Utilization

Task Set

SchedulableUnschedulable

� Modified Question: is there a threshold Ubound such that� When U < Ubound deadlines are met

� When U > Ubound deadlines may or may not be missed

?

All green area (sche

dulable)

Equivalent question:What’s the lowest utilization of an unschedulable task set?

critically(Called the Utilization Bound, U

bound)

∑=i i

i

P

C

Solution Approach: Look at Critically-Schedulable Task Sets

Utilization

Task Set� Modified Question: is there a threshold Ubound such that� When U < Ubound deadlines are met

� When U > Ubound deadlines may or may not be missed

?

All green area (sche

dulable)

Case (a) Case (b)Utilization increases with x

Utilization decreases with x

Find some task set parameter xsuch thatCase (a): x<xo � U(x) decreases with xCase (b): x>xo � U(x) increases with x

Thus U(x) is minimum when x=xo

Find U(xo)

Page 10: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

10

Deriving the Utilization Bound for Rate Monotonic Scheduling

� Consider a simple case: 2 tasks

Find some task set parameter xsuch that

Case (a): x<xo � U(x) decreases with xCase (b): x>xo � U(x) increases with x

Thus U(x) is minimum when x=xo

Find U(xo)

Deriving the Utilization Bound for Rate Monotonic Scheduling

� Consider a simple case: 2 tasks

P1

P2

Task 1

Task 2

Find some task set parameter xsuch that

Case (a): x<xo � U(x) decreases with xCase (b): x>xo � U(x) increases with x

Thus U(x) is minimum when x=xo

Find U(xo)

Page 11: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

11

Deriving the Utilization Bound for Rate Monotonic Scheduling

� Consider a simple case: 2 tasks

C1

P1

P2

Task 1

Task 2

Find some task set parameter xsuch that

Case (a): x<xo � U(x) decreases with xCase (b): x>xo � U(x) increases with x

Thus U(x) is minimum when x=xo

Find U(xo)

Deriving the Utilization Bound for Rate Monotonic Scheduling

� Consider a simple case: 2 tasks

C1

P1

P2

Task 1

Task 2

Critically schedulable

total = C2

Find some task set parameter xsuch that

Case (a): x<xo � U(x) decreases with xCase (b): x>xo � U(x) increases with x

Thus U(x) is minimum when x=xo

Find U(xo)

Page 12: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

12

Deriving the Utilization Bound for Rate Monotonic Scheduling

� Consider a simple case: 2 tasks

C1

P1

P2

Task 1

Task 2

?

Find some task set parameter xsuch that

Case (a): x<xo � U(x) decreases with xCase (b): x>xo � U(x) increases with x

Thus U(x) is minimum when x=xo

Find U(xo)

Deriving the Utilization Bound for Rate Monotonic Scheduling

� Consider a simple case: 2 tasks

C1

P1

P2

Task 1

Task 2

1

1

22 P

P

PP

Find some task set parameter xsuch that

Case (a): x<xo � U(x) decreases with xCase (b): x>xo � U(x) increases with x

Thus U(x) is minimum when x=xo

Find U(xo)

Page 13: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

13

Deriving the Utilization Bound for Rate Monotonic Scheduling

� Consider these two sub-cases:

Case (a):

C1

P1

P2

Task 1

Task 2

Case (b):

P1

P2

C1

1

1

22 P

P

PP

− 1

1

22 P

P

PP

Find some task set parameter xsuch that

Case (a): x<xo � U(x) decreases with xCase (b): x>xo � U(x) increases with x

Thus U(x) is minimum when x=xo

Find U(xo)

Deriving the Utilization Bound for Rate Monotonic Scheduling

� Consider these two sub-cases:

Case (a):

C1

P1

P2

Task 1

Task 2

1

1

221 P

P

PPC

−≤

Case (b):

P1

P2

C1

1

1

221 P

P

PPC

−>

Find some task set parameter xsuch that

Case (a): x<xo � U(x) decreases with xCase (b): x>xo � U(x) increases with x

Thus U(x) is minimum when x=xo

Find U(xo)

Page 14: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

14

Deriving the Utilization Bound for Rate Monotonic Scheduling

� Consider these two sub-cases:

Case (a):

C1

P1

P2

Task 1

Task 2

1

1

221 P

P

PPC

−≤

Case (b):

P1

P2

C1

1

1

221 P

P

PPC

−>

C1Find some task set parameter x

such that

Case (a): x<xo � U(x) decreases with xCase (b): x>xo � U(x) increases with x

Thus U(x) is minimum when x=xo

Find U(xo)

Deriving the Utilization Bound for Rate Monotonic Scheduling

� Consider these two sub-cases:

Case (a):

C1

P1

P2

Task 1

Task 2

1

1

221 P

P

PPC

−≤

Case (b):

P1

P2

C1

1

1

221 P

P

PPC

−>

C1Find some task set parameter x

such that

Case (a): x<xo � U(x) decreases with xCase (b): x>xo � U(x) increases with x

Thus U(x) is minimum when x=xo

Find U(xo)

Page 15: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

15

Deriving the Utilization Bound for Rate Monotonic Scheduling

� Consider these two sub-cases:

Case (a):

C1

P1

P2

Task 1

Task 2

1

1

221 P

P

PPC

−≤

Case (b):

P1

P2

C1

1

1

221 P

P

PPC

−>

C1Find some task set parameter x

such that

Case (a): x<xo � U(x) decreases with xCase (b): x>xo � U(x) increases with x

Thus U(x) is minimum when x=xo

Find U(xo)

Deriving the Utilization Bound for Rate Monotonic Scheduling

� Consider these two sub-cases:

Case (a):

C1

P1

P2

Task 1

Task 2

1

1

221 P

P

PPC

−≤

Case (b):

P1

P2

C1

1

1

221 P

P

PPC

−>

+

−= 1

1

2122

P

PCPC

−=

1

2112 )(

P

PCPC

−+=+= 11

1

2

1

2

2

1

2

2

1

1

P

P

P

P

P

C

P

C

P

CU

−+

=

1

2

1

2

2

1

1

2

2

1

P

P

P

P

P

C

P

P

P

PU

Page 16: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

16

Deriving the Utilization Bound for Rate Monotonic Scheduling

� Consider these two sub-cases:

Case (a):

C1

P1

P2

Task 1

Task 2

1

1

221 P

P

PPC

−≤

Case (b):

P1

P2

C1

1

1

221 P

P

PPC

−>

+

−= 1

1

2122

P

PCPC

−=

1

2112 )(

P

PCPC

−+

=

1

2

1

2

2

1

1

2

2

1

P

P

P

P

P

C

P

P

P

PU

C1

���� UC

1���� U

−+=+= 11

1

2

1

2

2

1

2

2

1

1

P

P

P

P

P

C

P

C

P

CU

Deriving the Utilization Bound for Rate Monotonic Scheduling

� The minimum utilization case:

C1

P1

P2

Task 1

Task 2

1

1

221 P

P

PPC

−=

−+= 11

1

2

1

2

2

1

P

P

P

P

P

CU

Page 17: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

17

Deriving the Utilization Bound for Rate Monotonic Scheduling

� The minimum utilization case:

C1

P1

P2

Task 1

Task 2

1

1

221 P

P

PPC

−=

−+= 11

1

2

1

2

2

1

P

P

P

P

P

CU

0

1

2

=

PP

d

dU

83.0≈⇒ U

21

2 =⇒P

P

−+= 11

1

2

1

2

1

2

1

2

2

1

P

P

P

P

P

P

P

P

P

PU

11

2 =

P

P

1

2

1

2

1

2 21

1

PP

PP

PP

U

+=⇒

Note that C1 = P2 – P1

−=

1

2

1

211

P

P

P

PPC

Generalizing to N Tasks

C1 = P2 – P1

C2 = P3 – P2

C3 = P4 – P3

...3

3

2

2

1

1 +++=P

C

P

C

P

CU

Page 18: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

18

Generalizing to N Tasks

C1 = P2 – P1

C2 = P3 – P2

C3 = P3 – P2

0

1

2

=

PP

d

dU0

2

3

=

PP

d

dU0

3

4

=

PP

d

dU …

...3

3

2

2

1

1 +++=P

C

P

C

P

CU

Generalizing to N Tasks

C1 = P2 – P1

C2 = P3 – P2

C3 = P3 – P2

0

1

2

=

PP

d

dU0

2

3

=

PP

d

dU0

3

4

=

PP

d

dU …

...3

3

2

2

1

1 +++=P

C

P

C

P

CU

n

i

i

P

P 11 2=⇒ +

−=⇒ 12

1nnU

Page 19: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

19

Generalizing to N Tasks

C1 = P2 – P1

C2 = P3 – P2

C3 = P3 – P2

0

1

2

=

PP

d

dU0

2

3

=

PP

d

dU0

3

4

=

PP

d

dU …

...3

3

2

2

1

1 +++=P

C

P

C

P

CU

n

i

i

P

P 11 2=⇒ +

−=⇒ 12

1nnU

2ln→∞→ Un

Periodic Tasks

Periodic Task Scheduling

Rate Monotonic EDF

Bound Optimality Bound Optimality

Page 20: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

20

Periodic Tasks

Periodic Task Scheduling

Rate Monotonic EDF

Bound Optimality Bound Optimality

Coming Up

Periodic Task Scheduling

Rate Monotonic EDF

Bound Optimality Bound Optimality

Page 21: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

21

Rate Monotonic Continued

� Rate monotonic scheduling is the optimal fixed-priority scheduling policy for periodic tasks.

� Optimality (Trial #1):

Rate Monotonic Continued

� Rate monotonic scheduling is the optimal fixed-priority scheduling policy for periodic tasks.

� Optimality (Trial #1): If any other fixed-priority scheduling policy can meet deadlines, so can RM.

Page 22: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

22

Rate Monotonic Continued

� Rate monotonic scheduling is the optimal fixed-priority scheduling policy for periodic tasks.

� Optimality (Trial #1): If any other fixed-priority scheduling policy can meet deadlines, so can RM

Rate Monotonic Continued

� Rate monotonic scheduling is the optimal fixed-priority scheduling policy for periodic tasks.

� Optimality (Trial #1): If any other fixed-priority scheduling policy can meet deadlines, so can RM

Page 23: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

23

Rate Monotonic Continued

� Rate monotonic scheduling is the optimal fixed-priority scheduling policy for periodic tasks.

� Optimality (Trial #1): If any other fixed-priority scheduling policy can meet deadlines, so can RM

Rate Monotonic Continued

� Rate monotonic scheduling is the optimal fixed-priority scheduling policy for periodic tasks.

� Optimality (Trial #1): If any other fixed-priority scheduling policy can meet deadlines, so can RM

Page 24: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

24

Rate Monotonic Continued

� Rate monotonic scheduling is the optimal fixed-priority scheduling policy for periodic tasks.

� Optimality (Trial #2): If any other fixed-priority scheduling policy can meet deadlines in the worst case scenario, so can RM.

� How to prove it?

Rate Monotonic Continued

� Rate monotonic scheduling is the optimal fixed-priority scheduling policy for periodic tasks.

� Optimality (Trial #2): If any other fixed-priority scheduling policy can meet deadlines in the worst case scenario, so can RM.

� How to prove it?

� Consider the worst case scenario

� If someone else can schedule then RM can

Page 25: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

25

The Worst-Case Scenario

� Q: When does a periodic task, T, experience the maximum delay?

� A: When it arrives together with all the higher-priority tasks (critical instance)

� Idea of Proof� If some higher-priority task does not arrive together with T, aligning the arrival times can only increase the completion time of T

Proof (Case 1)

Task 1

Task 2

Case 1: higher priority task 1 is running when task 2 arrives

Page 26: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

26

Proof

Task 1

Task 2

Case 1: higher priority task 1 is running when task 2 arrives

� shifting task 1 right will increase completion time of 2

Proof

Task 1

Task 2

Case 1: higher priority task 1 is running when task 2 arrives

� shifting task 1 right will increase completion time of 2

Task 1

Task 2

Page 27: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

27

Proof (Case 2)

Task 1

Task 2

Case 2: processor is idle when task 2 arrives

Proof (Case 2)

Task 1

Task 2

Case 2: processor is idle when task 2 arrives

� shifting task 1 left cannot decrease completion time of 2

Page 28: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

28

Proof (Case 2)

Task 1

Task 2

Task 1

Task 2

Case 2: processor is idle when task 2 arrives

� shifting task 1 left cannot decrease completion time of 2

Optimality of Rate Monotonic

� If any other policy can meet deadlines so can RM

Policy X meets deadlines?

Page 29: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

29

Optimality of Rate Monotonic

� If any other policy can meet deadlines so can RM

Policy X meets deadlines?

� RM meets deadlines

YES

Coming Up

Periodic Task Scheduling

Rate Monotonic EDF

Bound Optimality Bound Optimality

Page 30: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

30

Coming Up

Periodic Task Scheduling

Rate Monotonic EDF

Bound Optimality Bound Optimality

Utilization Bound of EDF

� Why is it 100%?

� Consider a task set where:

� Imagine a policy that reserves for each task i a fraction fi of each clock tick, where fi = Ci /Pi

1=∑i i

i

P

C

Clock tick

Page 31: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

31

Utilization Bound of EDF

� Imagine a policy that reserves for each task i a fraction fi of each time unit, where fi = Ci /Pi

� This policy meets all deadlines, because within each period Pi it reserves for task i a total time

� Time = fi Pi = (Ci / Pi) Pi = Ci (i.e., enough to finish)

Clock tick

Utilization Bound of EDF

� Pick any two execution chunks that are not in EDF order and swap them

Page 32: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

32

Utilization Bound of EDF

� Pick any two execution chunks that are not in EDF order and swap them

� Still meets deadlines!

Utilization Bound of EDF

� Pick any two execution chunks that are not in EDF order and swap them

� Still meets deadlines!

� Repeat swap until all in EDF order� EDF meets deadlines

Page 33: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

33

Periodic Tasks

Periodic Task Scheduling

Rate Monotonic EDF

Bound Optimality Bound Optimality

Done

Periodic Task Scheduling

Rate Monotonic EDF

Bound Optimality Bound Optimality

Page 34: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

34

Exercise:Know Your Worst Case Scenario

� Consider a periodic system of two tasks

� Let Ui = Ci /Pi (for i = 1,2)

� What is the maximum value of:

Πi(1+Ui)

for a schedulable system?

Deriving the Utilization Bound for Rate Monotonic Scheduling

� The minimum utilization case:

C1

P1

P2

Task 1

Task 2

1

1

221 P

P

PPC

−=

−+= 11

1

2

1

2

2

1

P

P

P

P

P

CU

−+= 11

1

2

1

2

1

2

1

2

2

1

P

P

P

P

P

P

P

P

P

PU

11

2 =

P

P

−=

1

2

1

211

P

P

P

PPC

( )

−=

1

2112

P

PCPC

Page 35: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

35

Deriving the Utilization Bound for Rate Monotonic Scheduling

� The minimum utilization case:

C1

P1

P2

Task 1

Task 2

1

1

221 P

P

PPC

−=

−+= 11

1

2

1

2

2

1

P

P

P

P

P

CU

−+= 11

1

2

1

2

1

2

1

2

2

1

P

P

P

P

P

P

P

P

P

PU

11

2 =

P

P

−=

1

2

1

211

P

P

P

PPC

C1

P1

P2

Task 1

Task 2

C2

Deriving the Utilization Bound for Rate Monotonic Scheduling

� The minimum utilization case:

C1

P1

P2

Task 1

Task 2

1

1

221 P

P

PPC

−=

−+= 11

1

2

1

2

2

1

P

P

P

P

P

CU

−+= 11

1

2

1

2

1

2

1

2

2

1

P

P

P

P

P

P

P

P

P

PU

11

2 =

P

P

−=

1

2

1

211

P

P

P

PPC

C1

P1

P2

Task 1

Task 2

C2

112

121

CPP

PCC

=−

=+

Page 36: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

36

Solutions

( )∏ =+

=+

=+=+

=+

=+=+

−=−=

−=

i iU

P

P

P

PC

P

CU

P

P

P

PC

P

CU

PPCPC

PPC

21

211

11

2

2

1

2

22

2

22

1

2

1

11

1

11

21112

121

Critically

Schedulable

Schedulable ( )∏ ≤+i iU 21

Solutions

( )∏ =+

=+

=+=+

=+

=+=+

−=−=

−=

i iU

P

P

P

PC

P

CU

P

P

P

PC

P

CU

PPCPC

PPC

21

211

11

2

2

1

2

22

2

22

1

2

1

11

1

11

21112

121

Critically

Schedulable

Schedulable ( )∏ ≤+i iU 21

Page 37: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

37

Solutions

( )∏ =+

=+

=+=+

=+

=+=+

−=−=

−=

i iU

P

P

P

PC

P

CU

P

P

P

PC

P

CU

PPCPC

PPC

21

211

11

2

2

1

2

22

2

22

1

2

1

11

1

11

21112

121

Critically

Schedulable

Schedulable ( )∏ ≤+i iU 21

Solutions

( )∏ =+

=+

=+=+

=+

=+=+

−=−=

−=

i iU

P

P

P

PC

P

CU

P

P

P

PC

P

CU

PPCPC

PPC

21

211

11

2

2

1

2

22

2

22

1

2

1

11

1

11

21112

121

Critically

Schedulable

Schedulable ( )∏ ≤+i iU 21

Page 38: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

38

The General Case

( )∏ ==+

=+

=+=+

=+

=+=+

−=

−=

+

+

inn

n

i

nn

nn

n

n

n

i

i

i

ii

i

i

i

nn

iii

P

P

P

P

P

P

P

PU

P

P

P

PC

P

CU

P

P

P

PC

P

CU

PPC

PPC

22

...1

211

11

2

1

12

3

1

2

1

1

1

1

Critically

Schedulable

Schedulable ( )∏ ≤+i iU 21

The General Case

( )∏ ==+

=+

=+=+

=+

=+=+

−=

−=

+

+

inn

n

i

nn

nn

n

n

n

i

i

i

ii

i

i

i

nn

iii

P

P

P

P

P

P

P

PU

P

P

P

PC

P

CU

P

P

P

PC

P

CU

PPC

PPC

22

...1

211

11

2

1

12

3

1

2

1

1

1

1

Critically

Schedulable

Schedulable ( )∏ ≤+i iU 21

Page 39: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

39

The General Case

( )∏ ==+

=+

=+=+

=+

=+=+

−=

−=

+

+

inn

n

i

nn

nn

n

n

n

i

i

i

ii

i

i

i

nn

iii

P

P

P

P

P

P

P

PU

P

P

P

PC

P

CU

P

P

P

PC

P

CU

PPC

PPC

22

...1

211

11

2

1

12

3

1

2

1

1

1

1

Critically

Schedulable

Schedulable ( )∏ ≤+i iU 21

The General Case

( )∏ ==+

=+

=+=+

=+

=+=+

−=

−=

+

+

inn

n

i

nn

nn

n

n

n

i

i

i

ii

i

i

i

nn

iii

P

P

P

P

P

P

P

PU

P

P

P

PC

P

CU

P

P

P

PC

P

CU

PPC

PPC

22

...1

211

11

2

1

12

3

1

2

1

1

1

1

Critically

Schedulable

Schedulable ( )∏ ≤+i iU 21

Page 40: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

40

The Hyperbolic Bound for Rate Monotonic Scheduling

� A set of periodic tasks is schedulable if:

( )∏ ≤+i iU 21

The Hyperbolic Bound for Rate Monotonic Scheduling

� A set of periodic tasks is schedulable if:

� It’s a better bound than

� Example:

� A system of two tasks with U1=0.8, U2=0.1

( )∏ ≤+i iU 21

( )∑ −≤i

n

inU 12 /1

Page 41: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

41

The Hyperbolic Bound for Rate Monotonic Scheduling

� A set of periodic tasks is schedulable if:

� It’s a better bound!

� Example:

� A system of two tasks with U1=0.8, U2=0.1

� Liu and Layland bound: U1+U2 = 0.9 > 0.83

( )∏ ≤+i iU 21

The Hyperbolic Bound for Rate Monotonic Scheduling

� A set of periodic tasks is schedulable if:

� It’s a better bound!

� Example:

� A system of two tasks with U1=0.8, U2=0.1

� Liu and Layland bound: U1+U2 = 0.9 > 0.83

� Hyperbolic bound (U1+1)(U2+1) =1.8 x 1.1=1.98 < 2

( )∏ ≤+i iU 21

Page 42: Real-Time Scheduling - Penn Engineeringlee/10cis541/papers/... · 2010. 1. 15. · Real-Time Scheduling Introduction to Real-Time Review Main vocabulary Definitions of tasks, task

42

Scheduling Taxonomy

Periodic Task Scheduling

Rate Monotonic EDF

Bound Optimality Bound Optimality

Scheduling Taxonomy

Periodic Task Scheduling

Rate Monotonic EDF

Bound Optimality Bound Optimality

Hyperbolic Bound