real real time systems time systems designing a real
play

Real Real- -Time Systems Time Systems Designing a real- - PowerPoint PPT Presentation

EDA222/DIT160 Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #10 Updated 2009-02-15 Real Real- -Time Systems Time Systems Designing a real- Designing a real -time system time system Logical function What should be done &


  1. EDA222/DIT160 – Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #10 Updated 2009-02-15 Real Real- -Time Systems Time Systems Designing a real- Designing a real -time system time system • Logical function What should be done & New design! • Temporal function When should it be done? Specification Specification • System model How should it be done? Implementation Implementation • Task model • Execution-time analysis • Task model Can it be done with the • Schedulability test given implementation? Verification Verification Task model Task model Task model Task model A task model A task model must be defined to be able to analyze the must be defined to be able to analyze the Implementation Implementation Abstract model Abstract model temporal behavior of a set of tasks. temporal behavior of a set of tasks. • The static parameters of a task describe characteristics that apply independent of other tasks. task body P1 is Interval : constant Duration := 5.0; – Derived from the specification or implementation of the system Next_Time : Time; begin Next_Time := Clock + Interval; – For example: period, deadline, WCET { } loop τ τ = C T D O , , , Action; delay until Next_Time; 1 1 1 1 1 1 • The dynamic parameters of a task describe effects that Next_Time := Next_Time + Interval; end loop ; end P1; occur during the execution of the task. task body P2 is Interval : constant Duration := 7.0; – Is a function of the run-time system and the characteristics Next_Time : Time; { } τ τ = begin C T D O , , , of other tasks Next_Time := Clock + Interval; 2 2 2 2 2 2 loop Action; – For example: start time, completion time, response time delay until Next_Time; Next_Time := Next_Time + Interval; end loop ; end P2; 1

  2. EDA222/DIT160 – Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #10 Updated 2009-02-15 Task model Task model Task model Task model Static task parameters: Static task parameters: Static task parameters: Static task parameters: (undisturbed) WCET C : i Task’s worst-case execution time (WCET) C T period : i i { } τ τ = – Represents the longest undisturbed execution time for one C T D O , , , D (relative) deadline : i i i i i i i iteration of the task O (absolute) time offset : i – Derived as a function of the task’s program code Task’s relative deadline (responsiveness constraint) D D i i – Represents the maximum allowed time within which the task must complete its execution – Applies relative to the time when the task becomes executable 0 t – Derived as a function of the environment (e.g., laws of nature, C i control theory, ...) O T i i Task model Task model Task model Task model Static task parameters: Different types of tasks: Different types of tasks: Static task parameters: • Periodic tasks T Task’s periodicity i – A periodic task arrives with a time interval T i – Represents how often the task should be repeated • Sporadic tasks – Each iteration of the task has the same WCET – A sporadic task arrives with a time interval ≥ T i O Task’s time offset i • Aperiodic tasks – Represents the first arrival time of the task, e.g., the earliest time instant at which the task becomes executable – An aperiodic task has no guaranteed minimum time between – Applies relative to a given ”origin” of the system two subsequent arrivals ⇒ Hard real ⇒ The arrival time of the n:th iteration of a task then becomes Hard real- -time systems can only contain periodic and time systems can only contain periodic and sporadic tasks. sporadic tasks. = + − ⋅ n A O ( n 1 ) T i i i 2

  3. EDA222/DIT160 – Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #10 Updated 2009-02-15 The importance of models The importance of models (this page deliberately left blank) (this page deliberately left blank) Dad? How do t hey know They dr ive bigger and Then t hey t ake t he Oh, I guess Honey, if you how much weight a br idge bigger t rucks over t he weight of t he last I should have don' t know t he can handle? bridge unt il it collapses! t ruck and r ebuild t he known t hat ! answer, j ust bridge SAY so! Free t ranslat ion f rom Swedish by J . J onsson Execution- -time analysis time analysis Execution- -time analysis time analysis Execution Execution Motivation: Motivation: • Worst-case execution time (WCET) is important since Real-time compiler Code Program – it is a prerequisite for (hard) schedulability analysis Compiler + (no input – resource needs should be estimated early in the design phase WCET data) WCET analysis • The execution time of a task depends on – program structure + input data – initial system state – temporal properties of the system (OS + hardware) for I:=1 to N loop begin – internal and external system events if A > K then A:=K-1; 42 42 Estimation of WCET should consequently be made else A:=K+1; if A < K while the program is compiled! then A:=K; else A:=K-1; end; 3

  4. EDA222/DIT160 – Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #10 Updated 2009-02-15 Execution- Execution -time analysis time analysis Execution- Execution -time analysis time analysis Execution time Requirements: Requirements: • WCET must be pessimistic but tight estimated WCET 0 ≤ ”Estimated WCET” – “Real WCET” < ε ( ε small compared to real WCET) real WCET pessimistic: pessimistic: to make sure assumptions made in the schedulability analysis of hard real-time tasks also apply at run time tight: tight: to avoid unnecessary waste of resources during scheduling of hard real-time tasks • The computational complexity of the analysis method Input data must be tractable A simple (yet challenging) example A simpler (but non- -trivial) example trivial) example A simple (yet challenging) example A simpler (but non Derive WCET for the following program: Derive WCET for the following program: Derive WCET for the following statement: Derive WCET for the following statement: Issues to consider: Issues to consider: Issues to consider: Issues to consider: A := A / B; for I:=1 to N loop • Input data is unknown • Execution time: begin – Iteration bounds must be known if A > K – affected by cache misses, pipeline conflicts, exceptions ... to facilitate analysis then A:=K-1; (T1) – depends on previous and (!) subsequent instructions else A:=K+1; (E1) • Path explosion – also depends on (unknown) input data if A < K – 4^N paths in this example • Observations: then A:=K; (T2) • Exclusion of non-executable (false) else A:=K-1; (E2) – accurate estimation of WCET must be based on a detailed end; paths timing model of the system architecture – T1 + E2 is a false path in the example – uncertainties are handled by making worst-case assumptions 4

  5. EDA222/DIT160 – Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #10 Updated 2009-02-15 Formulation of the WCET problem Formulation of the WCET problem Fundamental issues Fundamental issues • Issues in the analysis of program paths – how to limit WCET (if necessary, pessimistically) – how to eliminate false paths (in order to derive a tight Given a system WCET estimate) (= program structure + system platform) • Issues in the analysis of temporal behavior find the program’s “worst-case” execution time ”everything that takes time must be modeled in a realistic fashion (or at least not optimistically)” for all possible input data, initial system states – accurate and effective timing model of the system platform and (internal and external) system events (influence of, e.g., cache memories, pipelining, …) – consequences of system events at run time (e.g.: exceptions, interrupts, context switches) Path analysis Path analysis Path analysis Path analysis Shaw’ Shaw ’s Timing Schema (1989): s Timing Schema (1989): A control flow graph (CFG) describes The estimated WCET ( The estimated WCET (WCETe WCETe) is the ) is the the structure of the program execution time of the longest structural structural execution time of the longest for I:=1 to N loop path through the program path through the program begin Timing analysis problem: if A > K (I1) Find the longest executable path in then A:=K-1; (T1) WCETe = else A:=K+1; (E1) the program’s CFG N*(WCET(loop) + if A < K (I2) WCET(I1) + then A:=K; (T2) max(WCET(T1), WCET(E1)) + else A:=K-1; (E2) WCET(I2) + • CFG may not contain cycles end; max(WCET(T2), WCET(E2))) • Non-executable paths must be eliminated 5

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend