Top Banner
Integrated Control and Scheduling James Yang, Steve Sheng, Bill Li Instructor: Prof. Insup Lee
23

Integrated Control and Scheduling James Yang, Steve Sheng, Bill Li Instructor: Prof. Insup Lee.

Dec 20, 2015

Download

Documents

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: Integrated Control and Scheduling James Yang, Steve Sheng, Bill Li Instructor: Prof. Insup Lee.

Integrated Control and Scheduling

James Yang, Steve Sheng, Bill Li

Instructor: Prof. Insup Lee

Page 2: Integrated Control and Scheduling James Yang, Steve Sheng, Bill Li Instructor: Prof. Insup Lee.

Outline

• Motivation• Periodic scheduling• Control Concepts• Robust scheduling

Page 3: Integrated Control and Scheduling James Yang, Steve Sheng, Bill Li Instructor: Prof. Insup Lee.

Motivation

• Misunderstanding between control and scheduling communities– C: computer platforms provide deterministic,

fixed sampling period– S: control tasks have:

• fixed periods

• hard deadlines

• known worst-case execution times (WCETs)

Page 4: Integrated Control and Scheduling James Yang, Steve Sheng, Bill Li Instructor: Prof. Insup Lee.

The Vision

• Dynamic, flexible, interactive integrated control and scheduling environment– Control performance vs. computing resource– Relax known WCET

• On-line information exchange – Desired period of control task– Nominal execution time– Desired deadline

Page 5: Integrated Control and Scheduling James Yang, Steve Sheng, Bill Li Instructor: Prof. Insup Lee.

Delete,Real-Time Scheduling

• Concept about task– Periodic, sporadic, aperiodic– Worst case CPU time C, deadline D

• Scheduling of CPU time for periodic tasks– Static cyclic executive scheduling

• Off-line to generate execution table

– Priority-based scheduling• Assumption: Di=Ti, no communication, ideal kernel• Earliest deadline first(EDF)• Rate-monotonic(RM)

Page 6: Integrated Control and Scheduling James Yang, Steve Sheng, Bill Li Instructor: Prof. Insup Lee.

Periodic Task Scheduling

• EDF– If U<=1, then all deadlines will be met– Processor fully utilized with deadlines met

• RM– Tasks with shorter period get higher priority – If U<=n(2^1/n-1)– Iff Ri<Di for all tasks– Bad performance when Di<<Ti

Page 7: Integrated Control and Scheduling James Yang, Steve Sheng, Bill Li Instructor: Prof. Insup Lee.

Implementation and Scheduling of Periodic Control Loops

• What is control loop? – Three parts: data collection, algorithm

computation, output transmission– Periodical in most cases

• Implementation– Single-task approach– Multiple-task approach

Page 8: Integrated Control and Scheduling James Yang, Steve Sheng, Bill Li Instructor: Prof. Insup Lee.

Loop Timing Constrains

• The period should be constant• Input-output latency

– Decrease stability, limits performance

– Ignore if minimized, otherwise be considered

sample control sample control

period latency

Page 9: Integrated Control and Scheduling James Yang, Steve Sheng, Bill Li Instructor: Prof. Insup Lee.

Single-task Implementation

LOOPAwait clock interrupt

Data collection

Algorithm calculation

Output transmission

END

CurrentTime(t)

LOOP

Data collection

Algorithm calculation

Output transmission

t = t+h

WaitUntil(t)

END

Page 10: Integrated Control and Scheduling James Yang, Steve Sheng, Bill Li Instructor: Prof. Insup Lee.

Control Delay

• Separate algorithm calculation– Calculate output: make

use of current sample information

– Update state: update controller states

CurrentTime(t)

LOOP

Data collection

calculate output

Output transmission

update state

t = t+h

WaitUntil(t)

END

Page 11: Integrated Control and Scheduling James Yang, Steve Sheng, Bill Li Instructor: Prof. Insup Lee.

Timing Requirement

• Data collection: same instant every period

• Calculate output: ASA sample available

• Output transmission: immediately after CO, or at fixed instant after data collection

• Update state: before next period, or before release of next “calculate output”

Page 12: Integrated Control and Scheduling James Yang, Steve Sheng, Bill Li Instructor: Prof. Insup Lee.

Scheduling of Control Tasks

• Fixed-priority scheduling– Describe controller as period tasks – Rate-monotonic is optimal if D=T– Deadline-monotonic is optimal if D<=T, used

to improve important long period control tasks

Page 13: Integrated Control and Scheduling James Yang, Steve Sheng, Bill Li Instructor: Prof. Insup Lee.

Deadline Assignment

• Period T and execution time C are known

• Deadlines D must be assigned, optimal deadline assignment is NP-hard

• Effective-deadline-monotonic assignment– Later subtasks given just enough time

Dij=Di-Sum[j+1<=k<=ni]Cik

Page 14: Integrated Control and Scheduling James Yang, Steve Sheng, Bill Li Instructor: Prof. Insup Lee.

Scheduling Under Overload Conditions

• Relaxation of known worst-case execution time– Treat longer-than-worst actual execution time

as overload conditions– Algorithm: associate positive value with task

• Complete the most important tasks

• Avoid domino effect

Page 15: Integrated Control and Scheduling James Yang, Steve Sheng, Bill Li Instructor: Prof. Insup Lee.

Robust Aperiodic Scheduling

• Real-time systems should handle– Periodic tasks

• Hard deadlines

– Aperiodic tasks—irregular arrival times• Soft deadlines

– minimize average response time

• Firm deadlines– Reject tasks going to be late– Maximize completed tasks– Maximize system value

Page 16: Integrated Control and Scheduling James Yang, Steve Sheng, Bill Li Instructor: Prof. Insup Lee.

Assumptions

• All periodic tasks have hard deadlines, known constant period and WCET

• Arrival time of aperiodic tasks is unknown

• WCET of aperiodicities is known on arrival

• Aperiodicities have firm deadlines and can be rejected

Page 17: Integrated Control and Scheduling James Yang, Steve Sheng, Bill Li Instructor: Prof. Insup Lee.

Terminology

• J: a set of aperiodic Ji ordered by deadline

• ri:arrival time of Ji• Ci:max computation

time of Ji• Ci’:actual computation

time of Ji

• di:deadline of Ji• mi:deadline tolerance• vi:task value(relative

importance)• fi:finishing time• Ei:exceeding time

Page 18: Integrated Control and Scheduling James Yang, Steve Sheng, Bill Li Instructor: Prof. Insup Lee.

Total Bandwidth Algorithm

• Assign a suitable deadline– dk=max(rk, dk-1)+Ck/Us– d0=0

• Schedule it as periodic tasks

Page 19: Integrated Control and Scheduling James Yang, Steve Sheng, Bill Li Instructor: Prof. Insup Lee.

TB Algorithm: Example

Page 20: Integrated Control and Scheduling James Yang, Steve Sheng, Bill Li Instructor: Prof. Insup Lee.

Resource Reclaiming

• TB behavior depends on est. max time– What if the value is overestimated?

• Correct the assigned deadlines– di=ri’+Ci/Us– ri’=max(ri, d’i-1, fi-1)– At task completion, di’=ri’+Ci’/US

Page 21: Integrated Control and Scheduling James Yang, Steve Sheng, Bill Li Instructor: Prof. Insup Lee.

Resource Reclaiming: example

Page 22: Integrated Control and Scheduling James Yang, Steve Sheng, Bill Li Instructor: Prof. Insup Lee.

Schedulability

• Theorem: given a set n of periodic tasks with Up and a TB server with Us, the whole set is schedulable iff Up+Us<=1

• Lemma: in [t1,t2], if Cape is the total execution time of aperiodic tasks, then Cape<=(t2-t1)Us

Page 23: Integrated Control and Scheduling James Yang, Steve Sheng, Bill Li Instructor: Prof. Insup Lee.

Robust Scheduling

What if overload?– Assign large bandwidth to server– Introduce overload awareness

• RED algorithm