Real-Time Systems. Real-Time Systems. Verification by testing. Verification by testing

Similar documents
Verification by testing

AADL : about scheduling analysis

Real-time Scheduling

Multitasking and Real-time Scheduling

Virtual Memory. Background. No. 10. Virtual Memory: concept. Logical Memory Space (review) Demand Paging(1) Virtual Memory

A Predictable Execution Model for COTS-based Embedded Systems

Lecture 7 Real Time Task Scheduling. Forrest Brewer

A Generic and Compositional Framework for Multicore Response Time Analysis

Concurrent models of computation for embedded software

An Investigation into Server Parameter Selection for Hierarchical Fixed Priority Pre-emptive Systems

Multitasking and Real-time Scheduling

Sorting Review. Sorting. Comparison Sorting. CSE 680 Prof. Roger Crawfis. Assumptions

Compiler Design. Spring Register Allocation. Sample Exercises and Solutions. Prof. Pedro C. Diniz

Parallelism for Nested Loops with Non-uniform and Flow Dependences

Course Introduction. Algorithm 8/31/2017. COSC 320 Advanced Data Structures and Algorithms. COSC 320 Advanced Data Structures and Algorithms

Design and Analysis of Algorithms

ELEC 377 Operating Systems. Week 6 Class 3

Petri Net Based Software Dependability Engineering

Scheduling. In general, a scheduling scheme provides two features: An algorithm for ordering the use of system resources (in particular the CPUs)

S1 Note. Basis functions.

Cache Performance 3/28/17. Agenda. Cache Abstraction and Metrics. Direct-Mapped Cache: Placement and Access

Introduction to Programming. Lecture 13: Container data structures. Container data structures. Topics for this lecture. A basic issue with containers

Module Management Tool in Software Development Organizations

Wishing you all a Total Quality New Year!

The Codesign Challenge

Hermite Splines in Lie Groups as Products of Geodesics

CMPS 10 Introduction to Computer Science Lecture Notes

The Greedy Method. Outline and Reading. Change Money Problem. Greedy Algorithms. Applications of the Greedy Strategy. The Greedy Method Technique

APPLICATION OF MULTIVARIATE LOSS FUNCTION FOR ASSESSMENT OF THE QUALITY OF TECHNOLOGICAL PROCESS MANAGEMENT

2x x l. Module 3: Element Properties Lecture 4: Lagrange and Serendipity Elements

Maintaining temporal validity of real-time data on non-continuously executing resources

Mixed-Criticality Scheduling on Multiprocessors using Task Grouping

REFLECTING RTOS MODEL DURING WCET TIMING ANALYSIS: MSP430/FREERTOS CASE STUDY

An Optimal Algorithm for Prufer Codes *

Insertion Sort. Divide and Conquer Sorting. Divide and Conquer. Mergesort. Mergesort Example. Auxiliary Array

Adaptive Resource Allocation Control with On-Line Search for Fair QoS Level

Reliability and Energy-aware Cache Reconfiguration for Embedded Systems

Storage Binding in RTL synthesis

Kent State University CS 4/ Design and Analysis of Algorithms. Dept. of Math & Computer Science LECT-16. Dynamic Programming

Virtual Machine Migration based on Trust Measurement of Computer Node

Some material adapted from Mohamed Younis, UMBC CMSC 611 Spr 2003 course slides Some material adapted from Hennessy & Patterson / 2003 Elsevier

Motivation. EE 457 Unit 4. Throughput vs. Latency. Performance Depends on View Point?! Computer System Performance. An individual user wants to:

Technical Report. i-game: An Implicit GTS Allocation Mechanism in IEEE for Time- Sensitive Wireless Sensor Networks

Halmstad University Post-Print

Real-time Fault-tolerant Scheduling Algorithm for Distributed Computing Systems

Assembler. Building a Modern Computer From First Principles.

SLAM Summer School 2006 Practical 2: SLAM using Monocular Vision

Smoothing Spline ANOVA for variable screening

Avoiding congestion through dynamic load control

A mathematical programming approach to the analysis, design and scheduling of offshore oilfields

Solutions for Real-Time Communication over Best-Effort Networks

Help for Time-Resolved Analysis TRI2 version 2.4 P Barber,

Loop Transformations, Dependences, and Parallelization

NUMERICAL SOLVING OPTIMAL CONTROL PROBLEMS BY THE METHOD OF VARIATIONS

Mathematics 256 a course in differential equations for engineering students

Efficient Distributed File System (EDFS)

Review of approximation techniques

Assignment # 2. Farrukh Jabeen Algorithms 510 Assignment #2 Due Date: June 15, 2009.

Distributed Resource Scheduling in Grid Computing Using Fuzzy Approach

Lecture 15: Memory Hierarchy Optimizations. I. Caches: A Quick Review II. Iteration Space & Loop Transformations III.

Simulation Based Analysis of FAST TCP using OMNET++

4/11/17. Agenda. Princeton University Computer Science 217: Introduction to Programming Systems. Goals of this Lecture. Storage Management.

RAP. Speed/RAP/CODA. Real-time Systems. Modeling the sensor networks. Real-time Systems. Modeling the sensor networks. Real-time systems:

Proper Choice of Data Used for the Estimation of Datum Transformation Parameters

A Similarity-Based Prognostics Approach for Remaining Useful Life Estimation of Engineered Systems

Design and Implementation of an Energy Efficient Multimedia Playback System

Sorting. Sorting. Why Sort? Consistent Ordering

A Knowledge Sharing Resource Library Platform Based on Multivariate Large Data Predictive Compensation

A Binarization Algorithm specialized on Document Images and Photos

Architectural Optimization & Design of Embedded Systems based on AADL Performance Analysis

Bounding DMA Interference on Hard-Real-Time Embedded Systems *

Perfecting Preemption Threshold Scheduling for Object-Oriented Real-Time System Design: From The Perspective of Real-Time Synchronization

Concurrent Apriori Data Mining Algorithms

Exercises (Part 4) Introduction to R UCLA/CCPR. John Fox, February 2005

A comparison of MPCP and MSRP when sharing resources in the Janus multiple-processor on a chip platform

Dynamic Voltage Scaling of Supply and Body Bias Exploiting Software Runtime Distribution

Chapter 1. Introduction

NAG Fortran Library Chapter Introduction. G10 Smoothing in Statistics

Notes on Organizing Java Code: Packages, Visibility, and Scope

6.854 Advanced Algorithms Petar Maymounkov Problem Set 11 (November 23, 2005) With: Benjamin Rossman, Oren Weimann, and Pouya Kheradpour

Simulation: Solving Dynamic Models ABE 5646 Week 11 Chapter 2, Spring 2010

Real-Time Guarantees. Traffic Characteristics. Flow Control

An Entropy-Based Approach to Integrated Information Needs Assessment

LS-TaSC Version 2.1. Willem Roux Livermore Software Technology Corporation, Livermore, CA, USA. Abstract

Harvard University CS 101 Fall 2005, Shimon Schocken. Assembler. Elements of Computing Systems 1 Assembler (Ch. 6)

Outline. Digital Systems. C.2: Gates, Truth Tables and Logic Equations. Truth Tables. Logic Gates 9/8/2011

Fusion Performance Model for Distributed Tracking and Classification

CSE 326: Data Structures Quicksort Comparison Sorting Bound

with `ook-ahead for Broadcast WDM Networks TR May 14, 1996 Abstract

Solving two-person zero-sum game by Matlab

An Iterative Solution Approach to Process Plant Layout using Mixed Integer Optimisation

Problem Definitions and Evaluation Criteria for Computational Expensive Optimization

Comparison of Heuristics for Scheduling Independent Tasks on Heterogeneous Distributed Environments

CS1100 Introduction to Programming

X- Chart Using ANOM Approach

EECS 730 Introduction to Bioinformatics Sequence Alignment. Luke Huan Electrical Engineering and Computer Science

CSCI 104 Sorting Algorithms. Mark Redekopp David Kempe

Assembler. Shimon Schocken. Spring Elements of Computing Systems 1 Assembler (Ch. 6) Compiler. abstract interface.

Loop Transformations for Parallelism & Locality. Review. Scalar Expansion. Scalar Expansion: Motivation

Response-Time Guarantees in ATM Networks

Transcription:

EDA222/DIT161 Real-Tme Systems, Chalmers/GU, 2014/2015 Lecture #8 Real-Tme Systems Real-Tme Systems Lecture #8 Specfcaton Professor Jan Jonsson Implementaton System models Executon-tme analyss Department of Computer Scence and Engneerng Chalmers Unversty of Technology Verfcaton Verfcaton by testng Verfcaton by testng Congratulatons, Bulder Bob! It seems to be strong enough ths tme. Let s open the brdge. Dad? How do they know how much weght a brdge can handle? They drve bgger and bgger trucks over the brdge untl t collapses! Then they take the weght of the last truck and rebuld the brdge Oh, I guess I should have known that! Honey, f you don't know the answer, just SAY so! So, s ths how brdges (or other mechancal constructons) are bult? Free translaton from Swedsh by J. Jonsson Of course not! There are models (propertes of materals) and theores (laws of mechancs) nvolved to determne n advance that a constructon wll wthstand the predcted load. 1

EDA222/DIT161 Real-Tme Systems, Chalmers/GU, 2014/2015 Lecture #8 Verfcaton by models & theory Verfcaton How do we perform verfcaton (schedulablty analyss)? So, why cannot computer systems be bult and verfed n advance usng models and theores? Well, they can usng system models and schedulablty analyss Introduce abstract models of system components: (computaton requrements, tmng constrants) Processor model (resource capactes) Run-tme model (task states, dspatchng) Predct whether task executons wll meet constrants Use tmng-correct abstract system models Make sure that computaton requrements never exceed resource capactes Generate a (partal or complete) run-tme schedule resultng from task executons and detect worst-case scenaros Verfcaton Desgnng a real-tme system How do we facltate schedulablty analyss? Concurrent and reactve programmng paradgm Sutable schedulable entty (thread, method, ) Language constructs for expressng applcaton constrants for schedulable enttes (data types, annotatons, macros, ) WCET must be dervable for schedulable enttes (specal cauton wth usage of dynamc language constructs) Determnstc task executon Tme tables or statc/dynamc task prortes Preemptve task executon Run-tme protocols for access to shared resources (dynamc prorty adjustment and non-preemptable code sectons) New desgn! Specfcaton Implementaton Verfcaton What Logcal should functon be done & When Temporal should functon t be done? How System should mplementaton t be done? Can Abstract t be done system wth models the gven Schedulablty mplementaton? analyss 2

EDA222/DIT161 Real-Tme Systems, Chalmers/GU, 2014/2015 Lecture #8 Run-tme model The run-tme model expresses the state of a task: Implementaton Abstract model watng sgnal ready wat nterrupt runnng dspatch vod task1(object *self, nt p) { Acton1(); SEND(Perod1, Deadlne1, self, task1, p); vod task2(object *self, nt p) { Acton2(); SEND(Perod2, Deadlne2, self, task2, p); τ 1 τ = { C, T, D, O 1 1 1 1 1 Runnng: Currently executng task Ready: Task that s avalable for executon Watng: Task that cannot execute because t s needs access to a resource other than the processor vod kckoff(object *self, nt p) { AFTER(Offset1, &app1, p); AFTER(Offset2, &app2, p); man() { TINYTIMBER(&app_man, kckoff, 0); τ 2 τ = { C, T, D, O 2 2 2 2 2 The task model expresses the tmng behavor of a task: The statc parameters descrbe characterstcs of a task that apply ndependent of other tasks. These parameters are derved from the specfcaton or the mplementaton of the system For example: perod, deadlne, WCET Statc task parameters: τ τ = { C, T, D, O C :(undsturbed) WCET T : perod D :(relatve) deadlne O :(absolute) tme offset The dynamc parameters descrbe effects that occur durng the executon of a task. These parameters are a functon of the run-tme system and the characterstcs of other tasks For example: start tme, completon tme, response tme 0 C D t O T 3

EDA222/DIT161 Real-Tme Systems, Chalmers/GU, 2014/2015 Lecture #8 Statc task parameters: C Task s worst-case executon tme (WCET) Represents the longest undsturbed executon tme for one teraton of the task Derved as a functon of the task s program code D Task s relatve deadlne (responsveness constrant) Represents the maxmum allowed tme wthn whch the task must complete ts executon Apples relatve to the tme when the task becomes executable Derved as a functon of the envronment (e.g., laws of nature, control theory,...) Statc task parameters: T Task s perodcty Represents how often the task should be repeated Each teraton of the task has the same WCET O Task s tme offset Represents the frst arrval tme of the task, e.g., the earlest tme nstant at whch the task becomes executable Apples relatve to a gven orgn ( epoch ) of the system The arrval tme of the n:th teraton of a task then becomes A = O + ( n 1) T n Executon-tme analyss Dfferent types of tasks: Perodc tasks A perodc task arrves wth a tme nterval T Sporadc tasks A sporadc task arrves wth a tme nterval T Program (no nput data) Real-tme compler Compler + WCET analyss Code WCET Aperodc tasks An aperodc task has no guaranteed mnmum tme between two subsequent arrvals Hard real-tme systems can only contan perodc and sporadc tasks. for (=1; <=N; ++) { f (A > K) A = K-1; A = K+1; f (A < K) A = K; A = K-1; 42 4

EDA222/DIT161 Real-Tme Systems, Chalmers/GU, 2014/2015 Lecture #8 Motvaton: Executon-tme analyss Worst-case executon tme (WCET) s mportant snce t s a prerequste for (hard) schedulablty analyss resource needs should be estmated early n the desgn phase The executon tme of a task depends on program structure + nput data ntal system state temporal propertes of the system (OS + hardware) nternal and external system events Estmaton of WCET should consequently be made whle the program s compled! Requrements: Executon-tme analyss WCET must be pessmstc but tght 0 Estmated WCET Real WCET < ε (ε small compared to real WCET) pessmstc: to make sure assumptons made n the schedulablty analyss of hard real-tme tasks also apply at run tme tght: to avod unnecessary waste of resources durng schedulng of hard real-tme tasks The computatonal complexty of the analyss method must be tractable Executon-tme analyss A smple (yet challengng) example Executon tme Derve WCET for the followng program: estmated WCET real WCET Input data for (=1; <=N; ++) { f (A > K) A = K-1; (T1) A = K+1; (E1) f (A < K) A = K; (T2) A = K-1; (E2) Issues to consder: Input data s unknown Iteraton bounds must be known to facltate analyss Path exploson 4^N paths n ths example Excluson of non-executable (false) paths T1 + E2 s a false path n the example 5

EDA222/DIT161 Real-Tme Systems, Chalmers/GU, 2014/2015 Lecture #8 A smpler (but non-trval) example Formulaton of the WCET problem Derve WCET for the followng statement: Issues to consder: A = A / B; Executon tme: affected by cache msses, ppelne conflcts, exceptons... depends on prevous and (!) subsequent nstructons also depends on (unknown) nput data Observatons: accurate estmaton of WCET must be based on a detaled tmng model of the system archtecture uncertantes are handled by makng worst-case assumptons Gven a system (= program structure + system platform) fnd the program s worst-case executon tme for all possble nput data, ntal system states and (nternal and external) system events Fundamental ssues Path analyss Issues n the analyss of program paths how to lmt WCET (f necessary, pessmstcally) how to elmnate false paths (n order to derve a tght WCET estmate) Issues n the analyss of temporal behavor everythng that takes tme must be modeled n a realstc fashon (or at least not optmstcally) accurate and effectve tmng model of the system platform (nfluence of, e.g., cache memores, ppelnng, ) consequences of system events at run tme (e.g.: exceptons, nterrupts, context swtches) A control flow graph (CFG) descrbes the structure of the program Tmng analyss problem: Fnd the longest executable path n the program s CFG CFG may not contan cycles Non-executable paths must be elmnated 6

EDA222/DIT161 Real-Tme Systems, Chalmers/GU, 2014/2015 Lecture #8 Path analyss Shaw s Tmng Schema (1989): for (=1; <=N; ++) { f (A > K) A = K-1; (T1) A = K+1; (E1) f (A < K) A = K; (T2) A = K-1; (E2) The estmated WCET (WCETe) s the executon tme of the longest structural path through the program WCETe = N*(WCET(loop) + WCET(I1) + max(wcet(t1), WCET(E1)) + WCET(I2) + max(wcet(t2), WCET(E2))) Methods for path analyss Branches (alternatve paths) ntroduces the followng set of problems: 1. Iteratons (loops, recursons ) 2. Alternatve (f-then-, case ) Goal: Bound the number of teratons n a loop or recurson Elmnate non-executable (false) program paths Methods for path analyss The user annotates the program so that ts CFG only contans a lmted number of executable paths: Annotaton of loop bounds: Provde upper bounds on loop ndces and catch potental exceptons at run tme Elmnaton of false paths: Enumerate all possble paths and lst the set of false paths so that these can be avoded n the analyss Requres very detaled knowledge of the program s functon, but s therefore also very prone to errors! Methods for path analyss Automated method: Statc analyss (embedded n compler): Derve upper bounds on loop ndces requres an explct loop ndex does not always work for complcated termnaton condtons Elmnate false paths symbolcally execute the program and do assert wth respect to the possble values that varables are able to assume Prelmnary methods are promsng but only for farly smple programs where the analyss s trval! 7

EDA222/DIT161 Real-Tme Systems, Chalmers/GU, 2014/2015 Lecture #8 Methods for path analyss Tmng analyss for RISC processors The realty? Shaw s tmng schema mplctly assume that the executon tme of each language statement s constant and known Ths s a qute realstc assumpton for a mcro-controller type of processor that lacks ppelned executon lacks cache memores does not generate exceptons However, for the RISC type processor archtectures, these methods yeld very pessmstc results! RISC processors have several advanced mechansms (ppelnng, cachng, branch predcton, out-of-order executon, ) that cause sgnfcant varaton n the executon tme of a processor nstructon. We must therefore estmate the executon tme for each executable path through the program and at the same tme account for these mechansms. Ths can be solved by parttonng the program code nto code blocks and analyze each block separately. Today, mature methods for tmng analyss only exst for ppelnng and cachng. Tmng analyss for RISC processors Tmng analyss of cache memory Processor wth ppelne: IF ID EX M WB ICACHE DCACHE Sources of tme varatons: structural conflcts data conflcts branch conflcts Sources of tme varatons: cache msses Issues: Not enough to nvestgate an solated code block mss/ht depends on prevous executons of the code Instructon cache behavor s predctable for each path known sequence of code Data cache behavor s more dffcult to analyze data addresses can depend on the program s nput data 8

EDA222/DIT161 Real-Tme Systems, Chalmers/GU, 2014/2015 Lecture #8 Tmng analyss of ppelne Methods for tmng analyss Issues: Not enough to nvestgate an solated code block conflcts may occur on the boundary between code blocks Ppelne behavor s predctable for each path known sequence of code Extenson of Shaw s Tmng Schema Analyss s performed at code block level Mergng of paths at certan code locatons by estmatng the effects of worst-case stuatons (reduces path exploson) Data flow analyss: Analyss performed at code block level Propagaton of ppelne and cache states between blocks Integer Lnear Programmng Formulate an ILP problem as a functon of executon tme and number of executons at code block level Challenges Challenges So far, non-preemptve executon of program code on a sngle processor has been assumed. In realty, pseudo-parallel executon s typcally used, somethng whch requres preemptve executon. Preemptons wll affect system state (.e., cache contents wll change and ppelne wll be flushed) and must therefore be accounted for n the analyss. However, t s dffcult to account for these effects n the analyss of WCET, whch means that t must be handled at a hgher level (.e., n the schedulablty analyss). So far, non-preemptve schedulng of program code on a sngle processor has been assumed. In realty, multcore processors are used n real-tme systems, somethng whch presents new problems. Several processors may have copes of the same code and data n ther local cache memores, and any updates wll nvaldate the other copes. Ths must be accounted for n the analyss.... 9