Docsity

Utilization Bound Derivation for Rate Monotonic Scheduling, Study notes of Computer Science

Toggle sidebar
bg1
1
Periodic Task 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
BoundEDF = 100%
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)
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 1
P1=2
C1=1
Task 2
P2=3
C2=1.01
%3.83
3
01.1
2
1
2
2
1
1≈+=+= P
C
P
C
U
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
pf3
pf4
pf5
pf8

Partial preview of the text

Download Utilization Bound Derivation for Rate Monotonic Scheduling and more Study notes Computer Science in PDF only on Docsity!

Periodic Task 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

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)

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 U

bound

such that

 When U < U

bound

deadlines are met

 When U > U

bound

deadlines are missed

Example

(Rate-Monotonic Scheduling)

Task 1 P 1

C

1

Task 2

P 2 = C 2

2

2

1

1

P

C

P

C

U

0 1 2 3 4 5 6 time

U

 Question: is there a threshold U bound such that

 When U < U bound deadlines are met

 When U > Ubound deadlines are missed

Example

(Rate-Monotonic Scheduling)

Task 1

P 1 =

C 1 =

Task 2

P 2

C 2 =1.

2

2

1

1

P

C

P

C

U

0 1 2 3 4 5 6 time

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 1

P 1 =

C 1 =

Task 2

P 2

C 2 =1.

2

2

1

1

P

C

P

C

U

0 1 2 3 4 5 6 time

Missed deadline!

Unschedulable

U

 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 1

P 1 =

C 1 =

Task 2 P 2

C 2 =2.

2

2

1

1

P

C

P

C

U

0 1 2 3 4 5 6 time

U

 Question: is there a threshold Ubound such that

 When U < Ubound deadlines are met

 When U > U bound deadlines are missed

Another Example

(Rate-Monotonic Scheduling)

Task 1

P 1 =

C 1 =

Task 2 P 2

C 2 =2.

2

2

1

1

P

C

P

C

U

0 1 2 3 4 5 6 time

U

 Question: is there a threshold Ubound such that

 When U < Ubound deadlines are met

 When U > U bound deadlines are missed

Another Example

(Rate-Monotonic Scheduling)

Task 1 P 1

C

1

Task 2

P 2 = C 2

2

2

1

1

P

C

P

C

U

0 1 2 3 4 5 6 time

Schedulable!

U

 Question: is there a threshold U bound such that

 When U < U bound deadlines are met

 When U > Ubound deadlines are missed

Another Example

(Rate-Monotonic Scheduling)

Task 1 P 1

C

1

Task 2

P 2 = C 2

2

2

1

1

P

C

P

C

U

0 1 2 3 4 5 6 time

Schedulable!

U

 Question: is there a threshold U bound such that

 When U < U bound deadlines are met

 When U > Ubound deadlines are missed

Schedulability depends on task set!

No clean utilization threshold between schedulable and unschedulable

task sets!

Deriving the Utilization Bound

for Rate Monotonic Scheduling

 Consider a simple case: 2 tasks

Find some task set parameter x

such that

Case (a): x<xo  U(x) decreases with x Case (b): x>x o  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

P 1

P

2

Task 1

Task 2

Find some task set parameter x

such that

Case (a): x<xo  U(x) decreases with x Case (b): x>x o  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

C 1

P 1

P 2

Task 1

Task 2

Find some task set parameter x such that

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

Thus U(x) is minimum when x=x o Find U(xo)

Deriving the Utilization Bound

for Rate Monotonic Scheduling

 Consider a simple case: 2 tasks

C 1

P 1

P 2

Task 1

Task 2

Critically schedulable

total = C 2

Find some task set parameter x such that

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

Thus U(x) is minimum when x=x o Find U(xo)

Deriving the Utilization Bound

for Rate Monotonic Scheduling

 Consider a simple case: 2 tasks

C

1

P

1

P 2

Task 1

Task 2

Find some task set parameter x

such that Case (a): x<x o  U(x) decreases with x

Case (b): x>xo  U(x) increases with x

Thus U(x) is minimum when x=xo Find U(x o

Deriving the Utilization Bound

for Rate Monotonic Scheduling

 Consider a simple case: 2 tasks

C

1

P

1

P 2

Task 1

Task 2

1 1

2 2

P

P

P

P

Find some task set parameter x

such that Case (a): x<x o  U(x) decreases with x

Case (b): x>xo  U(x) increases with x

Thus U(x) is minimum when x=xo Find U(x o

Deriving the Utilization Bound

for Rate Monotonic Scheduling

 Consider these two sub-cases:

Case (a):

C 1

P 1

P

2

Task 1

Task 2

Case (b):

P 1

P

2

C 1

1 1

2 2 P P

P

P 

1

2 2 P P

P

P 

Find some task set parameter x

such that

Case (a): x<xo  U(x) decreases with x Case (b): x>x o  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):

C 1

P 1

P

2

Task 1

Task 2

1 1

2 1 2 P P

P

C P 

Case (b):

P 1

P

2

C 1

1 1

2 1 2 P P

P

C P 

Find some task set parameter x

such that

Case (a): x<xo  U(x) decreases with x Case (b): x>x o  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):

C 1

P 1

P 2

Task 1

Task 2

1 1

2 1 2

P

P

P

C P

Case (b):

P 1

P 2

C 1

1 1

2 1 2 P P

P

C P 

C

1 Find some task set parameter x such that

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

Thus U(x) is minimum when x=x o Find U(xo)

Deriving the Utilization Bound

for Rate Monotonic Scheduling

 Consider these two sub-cases:

Case (a):

C 1

P 1

P 2

Task 1

Task 2

1 1

2 1 2

P

P

P

C P

Case (b):

P 1

P 2

C 1

1 1

2 1 2 P P

P

C P 

C

1 Find some task set parameter x such that

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

Thus U(x) is minimum when x=x o Find U(xo)

Deriving the Utilization Bound

for Rate Monotonic Scheduling

 Consider these two sub-cases:

Case (a):

C

1

P

1

P 2

Task 1

Task 2

1 1

2 1 2

P

P

P

C P

Case (b):

P

1

P 2

C

1

1 1

2 1 2 P P

P

C P 

C 1

Find some task set parameter x

such that Case (a): x<x o  U(x) decreases with x

Case (b): x>xo  U(x) increases with x

Thus U(x) is minimum when x=xo Find U(x o

Deriving the Utilization Bound

for Rate Monotonic Scheduling

 Consider these two sub-cases:

Case (a):

C

1

P

1

P 2

Task 1

Task 2

1 1

2 1 2

P

P

P

C P

Case (b):

P

1

P 2

C

1

1 1

2 1 2 P P

P

C P 

1

2 2 2 1 P

P

C P C

1

2 2 (^11 ) P

P

C PC

1

2

1

2

2

1

2

2

1

1

P

P

P

P

P

C

P

C

P

C

U 

1

2

1

2

2

1

1

2

2

1

P

P

P

P

P

C

P

P

P

P

U

Generalizing to N Tasks

C 1 = P 2 – P 1

C 2 = P 3 – P 2

C

3

= P

3

– P

2

1

2

P

P

d

dU 0

2

3

P

P

d

dU 0

3

4

P

P

d

dU

3

3

2

2

1

1 = + + + P

C

P

C

P

C

U

n

i

i

P

P 1

1

1 n

U n

n→ ∞ U→ln 2

Aperiodic Tasks

 What if tasks do not arrive periodically?

 Sporadic tasks

 There is a minimum separation between

successive invocation arrivals

 Treat minimum separation as period

 Aperiodic tasks

 Feasible region calculus

Precedence Constraints

 Precedence constraints

 Adjust arrival times and deadlines

Processors and Resources

 In addition to the CPU, tasks may need resources

 Memory

 Disk

 Access to shared data structures

 etc.

 Resource types

 Space-multiplexed (e.g., memory: different tasks have different

parts of the resource)

 Time multiplexed (one task can access at a time)

 Serial: Two tasks can’t interleave their accesses (e.g., lock-protected

data structures)

 How do resource constraints affect scheduling and

schedulability analysis?

Mutual Exclusion Constraints

 Tasks that lock/unlock the same semaphore are

said to have a mutual exclusion constraint

Lock S Unlock S

Lock S

Unlock S

Critical sections

(Mutually exclusive)

Task 1

Task 2

Priority Inversion

 Locks and priorities may be at odds.

Locking results in priority inversion

High-priority task

Low-priority task

Lock S

Preempt.

Priority Inversion

 Locks and priorities may be at odds.

Locking results in priority inversion

High-priority task

Low-priority task

Lock S

Attempt to lock S

results in blocking

Preempt.

Priority Inversion

Priority Inversion

 How to account for priority inversion?

High-priority task

Low-priority task

Lock S

Attempt to lock S

results in blocking

Preempt.

Unlock S

Lock S

Unlock S

Priority Inversion

Unbounded Priority Inversion

 Consider the case below: a series of

intermediate priority tasks is delaying a

higher-priority one

High-priority task

Low-priority task

Lock S

Preempt.

Intermediate-priority tasks

Preempt.

Unbounded Priority Inversion

Attempt to lock S results in blocking

Unbounded Priority Inversion

 How to prevent unbounded priority

inversion?

High-priority task

Low-priority task

Lock S

Preempt.

Intermediate-priority tasks

Preempt.

Unbounded Priority Inversion

Attempt to lock S results in blocking

Notes on Projects

 Some pointers to embedded hardware:

 www.xbow.com

 www.moteiv.com

(Sensors, motes, processor boards, …)

 www.x10.com

(Environmental control interfaces, security cameras, …)

 www.phidgets.com

(Smart room gadgets)