Towards predictability in real-time embedded system design Lorentz-ARTIST Workshop Embedded Systems November 22, 2005 Jeroen Voeten, Jinfeng Huang, Oana.

Slides:



Advertisements
Similar presentations
INTERVAL Next Previous 13/02/ Timed extensions to SDL Analysis requirements –Assumptions on moments and duration Semantics with controllable time.
Advertisements

Programming in Occam-pi: A Tutorial By: Zain-ul-Abdin
Translation-Based Compositional Reasoning for Software Systems Fei Xie and James C. Browne Robert P. Kurshan Cadence Design Systems.
Marc Geilen, Eindhoven University of Technology, Information and Communication Systems 1 Object-Oriented Modelling and Specification.
Concurrency Important and difficult (Ada slides copied from Ed Schonberg)
Ch. 7 Process Synchronization (1/2) I Background F Producer - Consumer process :  Compiler, Assembler, Loader, · · · · · · F Bounded buffer.
Timed Automata.
Presented by: Thabet Kacem Spring Outline Contributions Introduction Proposed Approach Related Work Reconception of ADLs XTEAM Tool Chain Discussion.
Technische universiteit eindhoven 25 September 2002www.ics.ele.tue.nl/~btheelen1 Using the SHE Method for UML-based Performance Modelling B.D. Theelen.
Monitors Chapter 7. The semaphore is a low-level primitive because it is unstructured. If we were to build a large system using semaphores alone, the.
Automatic Verification of Component-Based Real-Time CORBA Applications Gabor Madl Sherif Abdelwahed
Predictable Design for Real-time Embedded Control A Case Study Jinfeng Huang & Jeroen Voeten Eindhoven University of Technology PROGRESS.
Page 1 Building Reliable Component-based Systems Chapter 16 - Component based embedded systems Chapter 16 Component based embedded systems.
1 Concurrent and Distributed Systems Introduction 8 lectures on concurrency control in centralised systems - interaction of components in main memory -
CS220 Software Development Lecture: Multi-threading A. O’Riordan, 2009.
Developing Verifiable Concurrent Software Tevfik Bultan Department of Computer Science University of California, Santa Barbara
Concurrency CS 510: Programming Languages David Walker.
3.5 Interprocess Communication Many operating systems provide mechanisms for interprocess communication (IPC) –Processes must communicate with one another.
3.5 Interprocess Communication
© Andy Wellings, 2003 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
Verifying Distributed Real-time Properties of Embedded Systems via Graph Transformations and Model Checking Gabor Madl
November 18, 2004 Embedded System Design Flow Arkadeb Ghosal Alessandro Pinto Daniele Gasperini Alberto Sangiovanni-Vincentelli
Multithreading in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
1 Organization of Programming Languages-Cheng (Fall 2004) Concurrency u A PROCESS or THREAD:is a potentially-active execution context. Classic von Neumann.
User-Level Interprocess Communication for Shared Memory Multiprocessors Brian N. Bershad, Thomas E. Anderson, Edward D. Lazowska, and Henry M. Levy Presented.
Concurrency - 1 Tasking Concurrent Programming Declaration, creation, activation, termination Synchronization and communication Time and delays conditional.
(C) 2009 J. M. Garrido1 Object Oriented Simulation with Java.
ECE 720T5 Winter 2014 Cyber-Physical Systems Rodolfo Pellizzoni.
Object Oriented Analysis & Design SDL Threads. Contents 2  Processes  Thread Concepts  Creating threads  Critical sections  Synchronizing threads.
Benjamin Gamble. What is Time?  Can mean many different things to a computer Dynamic Equation Variable System State 2.
Threads and Concurrency. A First Look at Some Key Concepts kernel The software component that controls the hardware directly, and implements the core.
Lecture 2 Foundations and Definitions Processes/Threads.
Java Threads 11 Threading and Concurrent Programming in Java Introduction and Definitions D.W. Denbo Introduction and Definitions D.W. Denbo.
Concurrent Programming in Java Dr. Zoltan Papp. Motivation: event driven, responsive systems Sequential approach: while ( true ) { do event = getEventId()
 2004 Deitel & Associates, Inc. All rights reserved. 1 Chapter 4 – Thread Concepts Outline 4.1 Introduction 4.2Definition of Thread 4.3Motivation for.
Dynamic Analysis of Multithreaded Java Programs Dr. Abhik Roychoudhury National University of Singapore.
© 2012 xtUML.org Bill Chown – Mentor Graphics Model Driven Engineering.
Reference: Ian Sommerville, Chap 15  Systems which monitor and control their environment.  Sometimes associated with hardware devices ◦ Sensors: Collect.
1 Concurrency Architecture Types Tasks Synchronization –Semaphores –Monitors –Message Passing Concurrency in Ada Java Threads.
Performance evaluation of component-based software systems Seminar of Component Engineering course Rofideh hadighi 7 Jan 2010.
Dynamic Architectures (Component Reconfiguration) with Fractal.
Multithreading in Java Sameer Singh Chauhan Lecturer, I. T. Dept., SVIT, Vasad.
ICS 313: Programming Language Theory Chapter 13: Concurrency.
Laboratory of Model Driven Engineering for Embedded Systems An Execution Framework for MARTE-based Models UML&AADL’2008 workshop Belfast, Northern Ireland.
Processor Architecture
Introduction to Operating Systems and Concurrency.
CSCI1600: Embedded and Real Time Software Lecture 28: Verification I Steven Reiss, Fall 2015.
13-1 Chapter 13 Concurrency Topics Introduction Introduction to Subprogram-Level Concurrency Semaphores Monitors Message Passing Java Threads C# Threads.
1 Model Driven Engineering Jeroen Voeten Eindhoven University of Technology Embedded Systems Institute Artist Meeting Linköping May 14, 2007.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Software Systems Verification and Validation Laboratory Assignment 4 Model checking Assignment date: Lab 4 Delivery date: Lab 4, 5.
Winter 2007SEG2101 Chapter 121 Chapter 12 Verification and Validation.
/ PSWLAB Thread Modular Model Checking by Cormac Flanagan and Shaz Qadeer (published in Spin’03) Hong,Shin Thread Modular Model.
Specifying Multithreaded Java semantics for Program Verification Abhik Roychoudhury National University of Singapore (Joint work with Tulika Mitra)
Slides created by: Professor Ian G. Harris Operating Systems  Allow the processor to perform several tasks at virtually the same time Ex. Web Controlled.
Operating Systems Unit 2: – Process Context switch Interrupt Interprocess communication – Thread Thread models Operating Systems.
Software Systems Division (TEC-SW) ASSERT process & toolchain Maxime Perrotin, ESA.
SystemC Semantics by Actors and Reduction Techniques in Model Checking Marjan Sirjani Formal Methods Lab, ECE Dept. University of Tehran, Iran MoCC 2008.
Agenda  Quick Review  Finish Introduction  Java Threads.
Reachability Testing of Concurrent Programs1 Reachability Testing of Concurrent Programs Richard Carver, GMU Yu Lei, UTA.
Concurrency (Threads) Threads allow you to do tasks in parallel. In an unthreaded program, you code is executed procedurally from start to finish. In a.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
Chapter 4 – Thread Concepts
Chapter 4 – Thread Concepts
Threads Chate Patanothai.
Monitors Chapter 7.
Monitors Chapter 7.
Monitors Chapter 7.
CSE 153 Design of Operating Systems Winter 19
Foundations and Definitions
Presentation transcript:

Towards predictability in real-time embedded system design Lorentz-ARTIST Workshop Embedded Systems November 22, 2005 Jeroen Voeten, Jinfeng Huang, Oana Florescu, Bart Theelen and Henk Corporaal ES Group, Eindhoven University of Technology Embedded Systems Institute

2 RT Embedded Software: ”Integration Hell” Complexity many hardware/software components verified and tested in isolation… Integration system does not work difficult to locate cause of problem modifications introduce unexpected new problems Prediction difficult to predict properties in advance Correctness/performance can only be checked late in design cycle through extensive testing

3 A Toy Example: Railroad Crossing Trains run independently at different velocities Velocities are constant Avoid collisions

4 Current Practice: Objects and Threads Train A (Active Object) Crossing (Passive Object) Train B (Active Object) Start_Motor(“A”, “Right”); Wait(SensorA); Delay(DistanceToCrossing/Velocity); if (!Crossing.getAccess(no_block)) { Stop_Motor(“A”); Crossing.getAccess(block); Start_Motor(“A”);} Delay(CrossingSize/Velocity);} Crossing.Release(); Wait(SensorD); Stop_Motor(“A”); class Crossing{ Semaphore Sem; void Crossing(){ Sem=CreateSem(1)} bool getAccess(bool block){ return Wait(Sem, block);} void Release(){ Signal(Sem);}}

5 Timing Property Between D and D+  seconds after Train A has passed Sensor A, check the Crossing and if it is occupied stop the train (D=DistanceToCrossing/Velocity) Execution trace:  1 +  2   ? SensorA signaled T Delay D T+D Check Crossing T+D+  1 Stop motor T+D+  1 +  2

6 Timing Property - Add Components Add new active objects to the software system (e.g. to control another railroad crossing) Execution trace:  +  1 +  2   BOOM !!! SensorA signaled T Delay D T+  +D Check Crossing T+  +D+  1 Stop motor T+  +D+  1 +  2 other active object running T+ 

7 A multithreaded code fragment char x=0, y=0, z=0, w=0; thread 1: x=1; y=1; z=1; thread 2: w=1; Works fine … probably … until platform is changed Works fine … probably … until platform is changed POSIX threads on Intel® Itanium® POSIX threads on Intel® Itanium® Any variable may be zero after both threads finish! Multicore and hyperthreading platforms will make such problems happen more often in future…

8 Property Prediction is Difficult! Execution semantics of component: All possible execution traces a component can be involved in A component satisfies a property if it is satisfied for each execution trace Execution semantics is context-dependent: processor platform RTOS compiler other software components in the system Property prediction requires component context properties cannot be predicted from component description alone if context changes component properties change ‘prediction’ typically done through testing on target platform

9 Predictable Approach: Principles Compositional Modeling Language context-independent semantics: all possible traces the component can be engaged in irrespective of context – compositionality: properties of composite deducible from properties of constituent – composability: properties of a component are preserved when context changes expressive (concurrency, time, succinct models, …) executable Predictable Mapping automatic mapping onto target hardware platform predict properties of the realization from model properties

10 Summary-Traditional versus Predictable Bottom-up & Code-drivenTop-down & Model-driven “Here is the code – let’s see how it executes” “This is the model – execute it according its semantics” “Heisenberg Testing Principle”“Tests do not influence rest” “Integration heaven”“Integration hell” Model & implementation consistency? Prediction? Model & implementation are consistent in case of feasible mapping. Prediction!

11 Active Objects and Compositionality? Then for each (active) object we need to: Assume potentially unbounded execution times Interpret Delay(T) as ‘delay at least T’ Suspect interference with any other object at any time Result Impossible to establish any real-time properties Difficult to establish other properties (such as invariants) Conclusion: active objects do not encourage a compositional way of working

12 Component-based Approaches Active objects cannot protect themselves well against unwanted interactions with environment yielding a tremendous amount of non-determinism semaphores/monitors/locks help, but are difficult to work with … Component-based approaches address this by strong encapsulation component interaction only via well-defined interfaces interaction often based on message passing component can decide at any time not to accepts message Examples: Kahn Process Networks (not for control, untimed) SDL Rose-RT (ROOM) POOSL

13 SDL’96 Tool: Cinderella Model has context-dependent timing semantics simulation results depend on platform simulation results depend on other processes in system No automatic code generation  Compositional Modeling Language  Predictable Mapping

14 SDL’96: Clock Example Expected: n-th tm:=tm+1 action to be issued at time n Reality: 31 st tm:=tm+1 issued around 52 nd second Reason: time in model is based on physical time

15 ROOM Tool: Rose-RT (IBM) Model has context-dependent timing semantics simulation results depend on platform simulation results depend on other processes in system Automatic code generation Real-time properties of realization cannot be predicted from model  Compositional Modeling Language  Predictable Mapping

16 SDL’2000 Tool: Tau Generation 2 (Telelogic) Model has compositional (timing) semantics established by virtual (model) time concept predictability support during modeling Automatic code generation Neither timing nor event ordering can be predicted from model Compositional Modeling Language  Predictable Mapping

17 SDL’2000: Code Generation – Time Error Timing Error (seconds) Virtual Time (seconds) Cumulative Timing Error on Target Platform

18 SDL’2000: Code Generation – Event Order Error pwait reply_signal ptimer Process P syn_signal Charstring wout=“wrong” ; Charstring cout=“correct” ; Timer ptimer() set(ptimer, now+3) out_signal(cout) out_signal(wout) reset(ptimer) reply_signal qwait qtimer qstart syn_signal qstart Process Q Timer qtimer() set(qtimer, now+2.99)

19 POOSL Parallel Object-Oriented Specification language Expressive and executable asynchronous concurrency synchronous message passing object-oriented data real-time and stochasticity dynamic process creation Formal (compositional) semantics two-phase execution model (X.Nicollin, J.Sifakis ‘91) Tools: SHESim and Rotalumis (RT) Source: X.Nicollin, J.Sifakis ’91

20 POOSL: Semantics POOSL Model Formal Semantics Timed Probabilistic Labelled Transition System (Segala Model) Simulation Process Execution Trees Formal Verification Model Checking Performance Analysis Worst/Best-Case Average-Case based on Markov Chain Predictable Code Generation ε -hypothesis

21 Code Generation: the  -hypothesis Generate timed trace from transition system Process Execution Trees, no RTOS, no threads ordering of events is kept Run-time synchronization upto  of virtual time with physical time Epsilon-hypothesis if an action happens at virtual time t in the model it must happen in physical time interval (t-  /2,t+  /2) in implementation In case hypothesis is satisfied every (MTL) formula in model is preserved upto  in realization Epsilon can be determined by modeling/analysis or measurement Compositional Modeling Language Predictable Mapping

22 Demo: The Railroad Crossing Velocity TrainA: 40 cm/s Velocity TrainB: 90 cm/s Analysis Model Synthesis Model Rapid analysis Realization

23

24 Comparison: the Java CubbyHole Sender CubbyHole (1-place buf) Receiver empty full(v) ?get(v) !put(v)

25 Readability: the Java CubbyHole public class CubbyHole { private int contents; privateboolean available = false; public synchronized int get() { while (available == false) { try { wait(); } catch (InterruptedException e) {} } available = false; notifyAll(); return contents; } public synchronized void put(int value) { while (available == true) { try { wait(); } catch (InterruptedException e) {} } contents = value; available = true; notifyAll(); } empty()() in?get(v);full(v)() full(v:Object)() out!put(v);empty()() CubbyHole inout

26 Efficiency: the Java CubbyHole Sender CubbyHole (1-place buf) ReceiverLanguage/Toolcom/seccycles/com SHESim (full POOSL,  ) Java (  ) C (Pthreads,Cygwin,  ) Rotalumis (full POOSL,  ) C++ (POOSL fragment,  )

27 Open Issues and Current Work Multi-processor platforms Predictable mapping globally asynchronous time; different clocks with different clock drifts Efficiency reduce run-time scheduling overhead (partial-order reduction) reduce PET overhead (static unfolding of transition system) Streaming dealing with time-intensive actions use of abstraction, factor out equivalence