560 likes | 763 Views
Combining Off-line Schedule Construction and Fixed Priority Scheduling in Real-Time Computer Systems. Radu Dobrin. Outline . Real-Time Systems Off-line vs. Fixed Priority Scheduling (FPS) Problem Formulation Application Areas Proposed Solution Summary. Real-Time Systems.
E N D
Combining Off-line Schedule Construction and Fixed Priority Scheduling in Real-Time Computer Systems Radu Dobrin
Outline • Real-Time Systems • Off-line vs. Fixed Priority Scheduling (FPS) • Problem Formulation • Application Areas • Proposed Solution • Summary
Real-Time Systems Computer systems in which the correctness of the system depends not only on the logical correctness of the computations performed, but also on the time factors (Stankovic et. al.) • Hard • no deadlines may be missed (avionics, nuclear power plants…etc) • Soft • some deadlines may be missed (multimedia applications) • “In between”… • ‘weakly hard RTS’ (Bernat et. al.) • ‘n’ of ‘m’ consecutive deadlines may be missed
Real-Time Systems • Resources • one or several processors • network (if distributed RTS) • … • Tasks • periodic • an infinite sequence of invocations (instances or jobs) • non-periodic • aperiodic, sporadic, etc • Scheduler • makes the decision which task to execute (on which processor) at each point in time based on the scheduling policy
Real-Time Systems Scheduling policy This talk: • off-line (table driven) scheduling • pre-runtime allocation of tasks to processors • priority-driven (on-line) scheduling • fixed priority scheduling (FPS) • dynamic priority scheduling (e.g., EDF) …in hard real-time systems
time 0 4 6 7 8 10 A B run-time dispatcher C D 0 6 7 10 4 8 Off-line (table driven) scheduling • off-line allocation of time-slots to tasks • run-time dispatcher selects task from scheduling tables A B C D
Off-line (table driven) scheduling • off-line allocation of time-slots to tasks • run-time dispatcher selects task from scheduling tables misc. complex constraints (instance separation, jitter, engineering practice constraints …) predictability determinism inflexible, task executions fixed need to know all task attributes before run-time
“ready list” run-time dispatcher Fixed Priority Scheduling (FPS) • schedulability test performed off-line – guarantees • on-line servers to handle non-periodic events • scheduling decisions made at run-time A B C D A B D B C
Fixed Priority Scheduling (FPS) • schedulability test performed off-line – guarantees • on-line servers to handle non-periodic events • scheduling decisions made at run-time widely used (automotive industry, network scheduling - CAN) flexible simple run-time mechanism small run-time overhead ability to handle complex constraints additional constraints – new schedulability tests
Proposed solution We want to combine the advantages provided by both: • methods that transform off-line schedulesintoattributes forfixed priority scheduling • execution of fixed priority tasks reenacts original off-line schedule at run-time, if scheduled by FPS
Proposed solution ability to handle complex constraintspredictability Off-line scheduling FPS simple run-time mechanism run-time flexibility FPS
Tasks with complex constraints Off-line scheduler Off-line schedule Constraints fullfiled FPS system We want: Tasks with FPS attributes Tasks with FPS attributes FPS Tasks with FPS attributes Tasks with FPS attributes Application scenarios Off-line sched. based system We have: Our method FPS schedule
Off-line scheduler Tasks with complex constraints Off-line schedule no priority ordering found? Our method Constraints fullfiled Tasks with FPS attributes FPS Application scenarios FPS system We have: We want: FPS system FPS schedule
Outline • Real-Time Systems • Off-line vs. Fixed Priority Scheduling (FPS) • Problem Formulation • Application Areas • Proposed Solution • Summary
Off-line to FPS transformation Method to transform off-line schedulesintoattributes forfixed priority scheduling – overview: • Input: off-line schedule and target windows (feasible time intervals for task executions) • derive sequences of task executions from overlapping target windows • derive priority inequalities • solve inequalities by Integer Linear Programming (ILP) • Output: minimum number of FPS tasks and priority levels
est dl A TW(A)=T(A) Off-line to FPS transformation Target Windows: feasible time intervals for task executions under FPS ex: periodic task with simple constraint (dl)
est est est est/dl dl dl dl T(A) T(A) TW(A) TW(A) Off-line to FPS transformation Target Windows: feasible time intervals for task executions under FPS ex: periodic task with an instance separation constraint A A
Off-line schedule TW(A) B A C t TW(B) TW(C) A B C Off-line to FPS transformation • first – task set with original constraints and off-line schedule • split off-line schedule into target windows • derive sequences of instances (each start of TW) TW(A) TW(B) TW(C)
{current instance}tk Off-line schedule {interfering instance}tk B A C t A tk Off-line to FPS transformation • first – task set with original constraints and off-line schedule • split off-line schedule into target windows • derive sequences of instances (each start of TW) A TW(A) B B TW(B) C TW(C) SEQk = <BA> =<A > B ordered
{current instance}tk {interfering instance}tk A Off-line to FPS transformation • first – task set with original constraints and off-line schedule • split off-line schedule into target windows • derive sequences of instances (each start of TW) A TW(A) B B TW(B) C TW(C) tk SEQk = <BA> =<A > B ordered
{current instance}tk+1 {interfering instance}tk+1 A tk+1 Off-line to FPS transformation • first – task set with original constraints and off-line schedule • split off-line schedule into target windows • derive sequences of instances (each start of TW) A TW(A) B TW(B) C C TW(C) SEQk+1 = <AC> =<C > A ordered
Off-line schedule B A C tk B A SEQk=<B A> Off-line to FPS transformation • first – task set with original constraints and off-line schedule • split off-line schedule into target windows • derive sequences of instances (each start of TW) • derive priority inequalities to reflect order of execution in the sequences => priority(B)>priority(A)
Off-line schedule A B B A ti tj t SEQi=<A B> SEQj=<B A> Priority(A)>Priority(B) ... Priority(B)>Priority(A) Off-line to FPS transformation • first – task set with original constraints and off-line schedule • split off-line schedule into target windows • derive sequences of instances (each start of TW) • derive priority inequalities to reflect order of execution in the sequences • problem – inconsistent priorities for instances of same task (not all off-line schedules can be expressed by FPS)
Off-line to FPS transformation • first – task set with original constraints and off-line schedule • split off-line schedule into target windows • derive sequences of instances (each start of TW) • derive priority inequalities to reflect order of execution in the sequences • problem – inconsistent priorities for instances of same task (not all off-line schedules can be expressed by FPS) • solution – modify the problem • treat task instances as new tasks – artifacts • which ones? • potentially many artifacts? useInteger Linear Programmingto • solvepriorityinequalities • minimizenumber of artifacts
ILP formulation Input: - priority inequalities, total nr. of instances Goal function: min G =# fps_tasks = # original_tasks+ (# instances(Ti) - 1)*bi Subject to: … constraints transformed from the priority inequalities 1– create artifacts for Ti’s instancesbi=0 – leave unchanged Output: - bi(which tasks to split) - priorities for fps_tasks
Temporal analysis • transformed FPS tasks execute within derived target windows at run-time • order of execution specified in off-line schedule preservedat run-time, if required by original constraints exact reenaction of off-line schedule by adjusting target windows
Complexconstraints current/interfering instances ILP So far… Off–line schedule Target windows input: instance sequences priority inequalities guaranteed output: FPS tasks
So far… • resolved attribute assignment problem in FPS for multiplecomplex timing constraints • can be used in CAN scheduling • scheduling messages with complex timing requirements • better results than processor scheduling • legacy systems • upgrade/migrate while preserving constraint guarantees • optimization techniques to minimize costs • if an off-line schedule exists, we can transform it to FPS!
So far… FPS • ability to handle complex constraints • predictability simple run-time mechanism run-time flexibility √ √ √ ?
Next: handling non periodic events? Usually done by using FPS servers • non-capacity preserving • e.g., background scheduling, polling server • capacity preserving • e.g., deferrable servers, slack stealing • RM based analysis exists • our task model is not RM based! • no optimal server exists • our goal • use servers to provide good service to non-periodic tasks • use/tweak existing ones? • develop new ones? • stillguarantee complex constraints on periodic tasks
Using non-capacity preserving servers Easy – server does not suspend itself • Off-line: • include server in off-line schedule construction • together with complex constrained periodic tasks • derive FPS attributes for both server and periodic tasks • On-line: • if server active and non-periodic request pending • WCET(server)=server capacity • else • BCET(server) = 0
A A TW(A) B TW(B) C C TW(C) tk+1 SEQk+1 = <AC> =<C > A ordered Using capacity preserving servers Difficult – server may execute unpredictable at any time during period • difficult to include in off-line schedule construction • additional interfering instances to the sequences!
A tk+1 Using capacity preserving servers Difficult – server may execute at any time during period • difficult to include in off-line schedule construction • additional interfering instances to the sequences! A TW(A) B S TW(B) C C TW(C) SEQk+1 = <AC> =<C > A ordered
A tk+1 Using capacity preserving servers Solution • take into account potential interference? • pessimistic – over constraining the LP formulation • provide users set of deadlines to prevent undesired interference • assign server highest feasible priority while guaranteeing completion before new deadlines dl(B) A TW(A) S B S TW(B) C C TW(C) SEQk+1 = <AC> =<C > A ordered
Task C T A 2 15 - precedence: A B B 6 15 - execution of A fixed between: (est(A)+2) and (est(A)+4) C 3 10 No fixed priority ordering found? Example constraints (for LCM) + + polling server (S,T=6,C=1)
Task C T A 2 15 - precedence: A B Off-line schedule B 6 15 - execution of A fixed between: (est(A)+2) and (est(A)+4) C 3 10 off-line scheduler A A A A S S S S S C C C B B B B B B C C C B B B B B B C C C 0 30 Example constraints (for LCM) + + polling server (S,T=6,C=1)
Task C T A 2 15 - precedence: A B Off-line schedule B 6 15 - execution of A fixed between: (est(A)+2) and (est(A)+4) C 3 10 off-line scheduler S S S S S A A A A B B B B B B B B B B B B C C C C C C C C C 0 30 Example constraints (for LCM) + + polling server (T=6,C=1)
S current instances C C C Off-line schedule prio(S)>prio(C) SEQ1=<SC> S S S S S A A A A B B B B B B B B B B B B C C C C C C C C C 0 30 Inequalities prio(S)>prio(C)
A A current instances Off-line schedule prio(A)>prio(C) SEQ2=<ACB> prio(C)>prio(B) S S S S S prio(A)>prio(C) prio(C)>prio(B) B B B B B B A A A A interfering instance C C B B B B B B B B B B B B C C C C C C C C C 0 30 Inequalities prio(S)>prio(C)
S current instance interfering instance Off-line schedule prio(S)>prio(B) SEQ3=<SB> S S S S S B B B B B B A A A A B B B B B B B B B B B B C C C C C C C C C 0 30 Inequalities prio(S)>prio(C) prio(A)>prio(C) prio(C)>prio(B) prio(S)>prio(B)
current instance interfering instance Off-line schedule prio(B)>prio(C) SEQ3=<BC> C C C S S S S S B B B B B B A A A A B B B B B B B B B B B B C C C C C C C C C 0 30 Inequalities prio(S)>prio(C) prio(A)>prio(C) prio(C)>prio(B) prio(S)>prio(B) prio(B)>prio(C)
Off-line schedule prio(S)>prio(B) SEQ4=<SBC> prio(B)>prio(C) S S S S S A A A A B B B B B B B B B B B B C C C C C C C C C 0 30 Inequalities prio(S)>prio(C) prio(A)>prio(C) prio(C)>prio(B) prio(S)>prio(B) prio(B)>prio(C)
Off-line schedule prio(A)>prio(B) SEQ5=<AB> S S S S S A A A A B B B B B B B B B B B B C C C C C C C C C 0 30 Inequalities prio(S)>prio(C) prio(A)>prio(D) prio(C)>prio(B) prio(S)>prio(B) prio(B)>prio(C) prio(A)>prio(B)
Off-line schedule SEQ6=<ASB> prio(A)>prio(S) prio(S)>prio(B) S S S S S A A A A B B B B B B B B B B B B C C C C C C C C C 0 30 Inequalities prio(S)>prio(C) prio(A)>prio(D) prio(C)>prio(B) prio(S)>prio(B) prio(B)>prio(C) prio(A)>prio(B) prio(A)>prio(S)
Off-line schedule prio(B)>prio(C) SEQ7=<BC> S S S S S A A A A B B B B B B B B B B B B C C C C C C C C C 0 30 Inequalities prio(S)>prio(C) prio(A)>prio(C) prio(C)>prio(B) prio(S)>prio(B) prio(B)>prio(C) prio(A)>prio(B) prio(A)>prio(S)
Off-line schedule prio(S)>prio(B) SEQ8=<SBC> prio(B)>prio(C) S S S S S A A A A B B B B B B B B B B B B C C C C C C C C C 0 30 Inequalities prio(S)>prio(C) prio(A)>prio(C) prio(C)>prio(B) prio(S)>prio(B) prio(B)>prio(C) prio(A)>prio(B) prio(A)>prio(S)
Off-line schedule prio(C)>prio(B) bc=1: create artifacts for C’s instances priorities: Prio(S) = 4 Prio(A) = 5 (highest) Prio(B) = 2 Prio(C1)= 3 Prio(C2)= 1 Prio(C3)= 1 #fps_tasks=6 prio(B)>prio(C) ILP S S S S S A A A A B B B B B B B B B B B B C C C C C C C C C 0 30 Inequalities prio(S)>prio(C) prio(A)>prio(C) prio(C)>prio(B) prio(S)>prio(B) prio(B)>prio(C) prio(A)>prio(B) prio(A)>prio(S)
Example FPS tasks Off-line scheduled tasks
original constraints • precedence: A B - execution of A fixed between: (est(A)+2) and (est(A)+4) Off-line schedule FPS schedule J1 J2 run-time execution A A A A S S S S S C C C B B B B B B C C C B B B B B B C C C 0 30 Example J1 J2 J2 S (prio 4) A (prio 5) A A B (prio 2) B B B C1 (prio 3) C1 C1 C2 (prio 1) C2 C3 (prio 1) C3