real time systems time systems real
play

Real- -Time Systems Time Systems Real Specification - PDF document

EDA222/DIT160 Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #10 Updated 2009-02-15 Real- -Time Systems Time Systems Real Specification Implementation Task model Execution-time analysis Verification Designing a real-


  1. EDA222/DIT160 – Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #10 Updated 2009-02-15 Real- -Time Systems Time Systems Real Specification Implementation • Task model • Execution-time analysis Verification Designing a real- -time system time system Designing a real • Logical function What should be done & New design! • Temporal function When should it be done? Specification • System model How should it be done? Implementation • Task model Can it be done with the • Schedulability test given implementation? Verification 1

  2. EDA222/DIT160 – Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #10 Updated 2009-02-15 Task model Task model Implementation Implementation Abstract model Abstract model task body P1 is Interval : constant Duration := 5.0; Next_Time : Time; begin Next_Time := Clock + Interval; { } loop τ = τ C T D O , , , Action; 1 1 1 1 1 delay until Next_Time; 1 Next_Time := Next_Time + Interval; end loop ; end P1; task body P2 is Interval : constant Duration := 7.0; Next_Time : Time; { } τ τ = begin C T D O , , , Next_Time := Clock + Interval; 2 2 2 2 2 2 loop Action; delay until Next_Time; Next_Time := Next_Time + Interval; end loop ; end P2; Task model Task model A A task model task model must be defined to be able to analyze the must be defined to be able to analyze the 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. – Derived from the specification or implementation of the system – For example: period, deadline, WCET • The dynamic parameters of a task describe effects that occur during the execution of the task. – Is a function of the run-time system and the characteristics of other tasks – For example: start time, completion time, response time 2

  3. EDA222/DIT160 – Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #10 Updated 2009-02-15 Task model Task model Static task parameters: Static task parameters: : (undisturbed) WCET C i T period : i { } τ τ = C T D O , , , D (relative) deadline : i i i i i i i O (absolute) time offset : i D i 0 t C i O T i i Task model Task model Static task parameters: Static task parameters: Task’s worst-case execution time (WCET) C i – Represents the longest undisturbed execution time for one iteration of the task – Derived as a function of the task’s program code Task’s relative deadline (responsiveness constraint) D i – Represents the maximum allowed time within which the task must complete its execution – Applies relative to the time when the task becomes executable – Derived as a function of the environment (e.g., laws of nature, control theory, ...) 3

  4. EDA222/DIT160 – Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #10 Updated 2009-02-15 Task model Task model Static task parameters: Static task parameters: T Task’s periodicity i – Represents how often the task should be repeated – Each iteration of the task has the same WCET Task’s time offset O i – Represents the first arrival time of the task, e.g., the earliest time instant at which the task becomes executable – Applies relative to a given ”origin” of the system The arrival time of the n:th iteration of a task then becomes = + − ⋅ n A O ( n 1 ) T i i i Task model Task model Different types of tasks: Different types of tasks: • Periodic tasks – A periodic task arrives with a time interval T i • Sporadic tasks – A sporadic task arrives with a time interval ≥ T i • Aperiodic tasks – An aperiodic task has no guaranteed minimum time between two subsequent arrivals ⇒ Hard real ⇒ Hard real- -time systems can only contain periodic and time systems can only contain periodic and sporadic tasks. sporadic tasks. 4

  5. EDA222/DIT160 – Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #10 Updated 2009-02-15 The importance of models The importance of models Dad? How do t hey know Then t hey t ake t he They drive bigger and Oh, I guess Honey, if you how much weight a bridge weight of t he last bigger t rucks over t he I should have don' t know t he can handle? bridge unt il it collapses! t ruck and rebuild t he known t hat ! answer, j ust bridge SAY so! Free t ranslat ion f rom Swedish by J. J onsson (this page deliberately left blank) (this page deliberately left blank) 5

  6. EDA222/DIT160 – Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #10 Updated 2009-02-15 Execution- -time analysis time analysis Execution Real-time compiler Code Program Compiler + (no input WCET data) WCET analysis for I:=1 to N loop begin if A > K then A:=K-1; 42 42 else A:=K+1; if A < K then A:=K; else A:=K-1; end; Execution- -time analysis time analysis Execution Motivation: Motivation: • Worst-case execution time (WCET) is important since – it is a prerequisite for (hard) schedulability analysis – resource needs should be estimated early in the design phase • The execution time of a task depends on – program structure + input data – initial system state – temporal properties of the system (OS + hardware) – internal and external system events Estimation of WCET should consequently be made while the program is compiled! 6

  7. EDA222/DIT160 – Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #10 Updated 2009-02-15 Execution- -time analysis time analysis Execution Requirements: Requirements: • WCET must be pessimistic but tight 0 ≤ ”Estimated WCET” – “Real WCET” < ε ( ε small compared to 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 must be tractable Execution- -time analysis time analysis Execution Execution time estimated WCET real WCET Input data 7

  8. EDA222/DIT160 – Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #10 Updated 2009-02-15 A simple (yet challenging) example A simple (yet challenging) example Derive WCET for the following program: Derive WCET for the following program: Issues to consider: Issues to consider: for I:=1 to N loop • Input data is unknown begin – Iteration bounds must be known if A > K to facilitate analysis then A:=K-1; (T1) else A:=K+1; (E1) • Path explosion if A < K – 4^N paths in this example then A:=K; (T2) • Exclusion of non-executable (false) else A:=K-1; (E2) end; paths – T1 + E2 is a false path in the example A simpler (but non- -trivial) example trivial) example A simpler (but non Derive WCET for the following statement: Derive WCET for the following statement: Issues to consider: Issues to consider: A := A / B; • Execution time: – affected by cache misses, pipeline conflicts, exceptions ... – depends on previous and (!) subsequent instructions – also depends on (unknown) input data • Observations: – accurate estimation of WCET must be based on a detailed timing model of the system architecture – uncertainties are handled by making worst-case assumptions 8

  9. 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 Given a system (= program structure + system platform) find the program’s “worst-case” execution time for all possible input data, initial system states and (internal and external) system events 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 WCET estimate) • Issues in the analysis of temporal behavior ”everything that takes time must be modeled in a realistic fashion (or at least not optimistically)” – accurate and effective timing model of the system platform (influence of, e.g., cache memories, pipelining, …) – consequences of system events at run time (e.g.: exceptions, interrupts, context switches) 9

  10. EDA222/DIT160 – Real-Time Systems, Chalmers/GU, 2008/2009 Lecture #10 Updated 2009-02-15 Path analysis Path analysis A control flow graph (CFG) describes the structure of the program Timing analysis problem: Find the longest executable path in the program’s CFG • CFG may not contain cycles • Non-executable paths must be eliminated Path analysis Path analysis Shaw Shaw’ ’s Timing Schema (1989): s Timing Schema (1989): The estimated WCET ( The estimated WCET (WCETe WCETe) is the ) is the execution time of the longest structural execution time of the longest structural for I:=1 to N loop path through the program path through the program begin if A > K (I1) then A:=K-1; (T1) WCETe = else A:=K+1; (E1) 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) + end; max(WCET(T2), WCET(E2))) 10

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