Top Banner
October 3, 2005 CIS 700 1 Real-Time Scheduling CIS700 Insup Lee 
32

Lec07 Real Time Scheduling

Apr 05, 2018

Download

Documents

Babak Karimi
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 1/32

October 3, 2005 CIS 700 1

Real-Time Scheduling 

CIS700

Insup Lee 

Page 2: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 2/32

October 3, 2005 CIS 700 2

Outline

• Real-time systems

• Real-time scheduling algorithms– Fixed-priority algorithm (RM)

– Dynamic-priority algorithm (EDF)

Page 3: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 3/32

October 3, 2005 CIS 700 3

Real-Time Systems

• Definition– Systems whose correctness depends on their temporal 

aspects as well as their functional aspects

• Performance measure– Timeliness on timing constraints (deadlines) 

– Speed/average case performance are less significant.

• Key property– Predictability on timing constraints

Page 4: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 4/32

October 3, 2005 CIS 700 4

Real-Time System Example

• Digital control systems– periodically performs the following job:

senses the system status and

actuates the system according to its current status

Control-LawComputation

Sensor

Actuator

Page 5: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 5/32

October 3, 2005 CIS 700 5

Real-Time System Example

Multimedia

• Multimedia applications– periodically performs the following job:

reads, decompresses, and displays video and audiostreams

Page 6: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 6/32

October 3, 2005 CIS 700 6

Fundamental Real-Time Issue

• To specify the timing constraints of real-time systems

• To achieve predictability on satisfying their timingconstraints, possibly, with the existence of otherreal-time systems

Page 7: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 7/32

October 3, 2005 CIS 700 7

Scheduling Framework Example

CPU

OS Scheduler 

Digital Controller Multimedia

Page 8: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 8/32

October 3, 2005 CIS 700 8

Real-Time Workload

• Job (unit of work)– a computation, a file read, a message transmission, etc

• Attributes– Resources required to make progress

– Timing parameters

Released 

Absolutedeadline

Relative deadline

Execution time

Page 9: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 9/32

October 3, 2005 CIS 700 9

Real-Time Task

• Task : a sequence of similar jobs– Periodic task ( p,e )

• Its jobs repeat regularly

• Period p = inter-release time (0 < p )

• Execution time e = maximum execution time (0 < e < p )• Utilization U = e/p

5 10 150

Page 10: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 10/32

October 3, 2005 CIS 700 10

Deadlines: Hard vs. Soft

• Hard deadline– Disastrous or very serious consequences may occur if

the deadline is missed

– Validation is essential : can all the deadlines be met,

even under worst-case scenario?– Deterministic guarantees

• Soft deadline

– Ideally, the deadline should be met for maximumperformance. The performance degrades in case ofdeadline misses.

– Best effort approaches / statistical guarantees

Page 11: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 11/32

October 3, 2005 CIS 700 11

Schedulability

• Property indicating whether a real-time system (a setof real-time tasks) can meet their deadlines

(4,1)

(5,2)

(7,2)

Page 12: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 12/32

October 3, 2005 CIS 700 12

Real-Time Scheduling

• Determines the order of real-time task executions• Static-priority scheduling

• Dynamic-priority scheduling

(4,1)

(5,2)

(7,2)

5

5

10

10 15

15

Page 13: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 13/32

October 3, 2005 CIS 700 13

RM (Rate Monotonic)

• Optimal static-priority scheduling• It assigns priority according to period

• A task with a shorter period has a higher priority

• Executes a job with the shortest period

(4,1)

(5,2)

(7,2)

5

5

10

10 15

15

T1

T2

T3

Page 14: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 14/32

October 3, 2005 CIS 700 14

RM (Rate Monotonic)

• Executes a job with the shortest period

(4,1)

(5,2)

(7,2)

5

5

10

10 15

15

T1

T2

T3

Page 15: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 15/32

October 3, 2005 CIS 700 15

RM (Rate Monotonic)

• Executes a job with the shortest period

(4,1)

(5,2)

(7,2)

Deadline Miss !

5

5

10

10 15

15

T1

T2

T3

Page 16: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 16/32

October 3, 2005 CIS 700 16

Response Time

• Response time– Duration from released time to finish time

(4,1)

(5,2)

(10,2)

5

5

10

10 15

15

T1

T2

T3

Page 17: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 17/32

October 3, 2005 CIS 700 17

Response Time

• Response time– Duration from released time to finish time

(4,1)

(5,2)

(10,2)

Response Time 

5

5

10

10 15

15

T1

T2

T3

Page 18: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 18/32

October 3, 2005 CIS 700 18

Response Time

• Response Time (r i ) [Audsley et al., 1993]

• HP(T i ) : a set of higher-priority tasks than T i 

(4,1)

(5,2)

(10,2)

T  HPT  k 

iii e

 p

r er 

ik 

)(

5

5

10

10

T1

T2

T3

Page 19: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 19/32

October 3, 2005 CIS 700 19

RM - Schedulability Analysis

• Real-time system is schedulable under RMif and only if r i  ≤ p i  for all task T i(pi,ei) 

Joseph & Pandya,

“Finding response times in a real-time system”,

The Computer Journal, 1986.

Page 20: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 20/32

October 3, 2005 CIS 700 20

RM  – Utilization Bound

• Real-time system is schedulable under RM if∑Ui ≤ n (21/n-1)

Liu & Layland,

“Scheduling algorithms for multi-programming in ahard-real-time environment”, Journal of ACM, 1973.

Page 21: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 21/32

October 3, 2005 CIS 700 21

RM  – Utilization Bound

• Real-time system is schedulable under RM if∑Ui ≤ n (21/n-1)

• Example: T 1(4,1), T 2(5,1), T 3(10,1),

∑Ui = 1/4 + 1/5 + 1/10= 0.55

3 (21/3-1) ≈ 0.78 

Thus, {T 1, T 2, T 3} is schedulable under RM.

Page 22: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 22/32

October 3, 2005 CIS 700 22

RM Utilization Bounds

0.5

0.6

0.7

0.8

0.9

1

1.1

1 4 16 64 256 1024 4096

The Number of Tasks

      U

      t      i      l      i     z     a      t      i     o     n

RM  – Utilization Bound

• Real-time system is schedulable under RM if∑Ui ≤ n (21/n-1)

Page 23: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 23/32

October 3, 2005 CIS 700 23

EDF (Earliest Deadline First)

• Optimal dynamic priority scheduling• A task with a shorter deadline has a higher priority

• Executes a job with the earliest deadline

(4,1)

(5,2)

(7,2)

5

5

10

10 15

15

T1

T2

T3

Page 24: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 24/32

October 3, 2005 CIS 700 24

EDF (Earliest Deadline First)

• Executes a job with the earliest deadline

(4,1)

(5,2)

(7,2)

5

5

10

10 15

15

T1

T2

T3

Page 25: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 25/32

October 3, 2005 CIS 700 25

EDF (Earliest Deadline First)

• Executes a job with the earliest deadline

(4,1)

(5,2)

(7,2)

5

5

10

10 15

15

T1

T2

T3

Page 26: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 26/32

October 3, 2005 CIS 700 26

EDF (Earliest Deadline First)

• Executes a job with the earliest deadline

(4,1)

(5,2)

(7,2)

5

5

10

10 15

15

T1

T2

T3

Page 27: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 27/32

October 3, 2005 CIS 700 27

EDF (Earliest Deadline First)

• Optimal scheduling algorithm– if there is a schedule for a set of real-time tasks,

EDF can schedule it.

(4,1)

(5,2)

(7,2)

5

5

10

10 15

15

T1

T2

T3

Page 28: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 28/32

October 3, 2005 CIS 700 28

Processor Demand Bound

• Demand Bound Function : dbf(t) – the maximum processor demand by workload over any

interval of length t  

(4,1)

(5,2)

(7,2)

5

5

10

10 15

15

T1

T2

T3

Page 29: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 29/32

October 3, 2005 CIS 700 29

EDF - Schedulability Analysis

• Real-time system is schedulable under EDFif and only if dbf(t) ≤ t for all interval t 

Baruah et al.

“Algorithms and complexity concerning the preemptivescheduling of periodic, real-time tasks on oneprocessor”, Journal of Real-Time Systems, 1990.

• Demand Bound Function : dbf(t)– the maximum processor demand by workload over any

interval of length t 

Page 30: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 30/32

October 3, 2005 CIS 700 30

EDF  – Utilization Bound

• Real-time system is schedulable under EDF if and onlyif

∑Ui ≤ 1 

Liu & Layland,“Scheduling algorithms for multi-programming in ahard-real-time environment”, Journal of ACM, 1973.

Page 31: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 31/32

October 3, 2005 CIS 700 31

• Domino effect during overload conditions– Example: T 1(4,3), T 2(5,3), T 3(6,3), T 4(7,3)

EDF  – Overload Conditions

T1

50 7

T2 T3 T4

3 6

Deadline Miss !

T1

50 7

T3

3 6

Better schedules :

T1

50 7

T4

3 6

Page 32: Lec07 Real Time Scheduling

7/31/2019 Lec07 Real Time Scheduling

http://slidepdf.com/reader/full/lec07-real-time-scheduling 32/32

October 3 2005 CIS 700 32

RM vs. EDF

• Rate Monotonic– Simpler implementation, even in systems without

explicit support for timing constraints (periods,deadlines)

– Predictability for the highest priority tasks

• EDF– Full processor utilization– Misbehavior during overload conditions

• For more details: Buttazzo, “Rate monotonic vs. EDF:Judgement Day”, EMSOFT 2003.