1 Componentbased approach for embedded systems Ivica Crnkovic
1 Component-based approach for embedded systems Ivica Crnkovic Mälardalen University (Md. H) Department of Computer Science and Electronics, Mälardalen Real-time Research Centre (MRTC) Sweden http: //www. idt. mdh. se/~icc 10/29/2021
2 Mälardalen University (Md. H) Mälardalen University, Vasteras (Västerås) Prof. in Software Engineering http: //www. idt. mdh. se/~icc ivica. crnkovic@mdh. se Department of Computer Engineering Real-Time Systems Design Lab Computer Architecture Lab Computer Science Lab Software Engineering Lab 10/29/2021
3 Outline • Basic characteristics of Component-based Software Engineering • Component-based approach in different domains – benefits and challenges • Embedded systems – some examples • CBSE for different types of embedded systems – concerns 10/29/2021
4 Sources of information http: //www-artist. imag. fr/Overview/ http: //www. cbsenet. org/pls/CBSEnet/ecolnet. home SAVE http: //www. mrtc. mdh. se/SAVE/ Ivica Crnkovic and Magnus Larsson: Building Reliable Component-Based Software Systems Artech House Publishers, 2002, ISBN 1 -58053 -327 -2 http: //www. idt. mdh. se/cbse-book/ 10/29/2021
5 Component-based approach • Building systems from (existing) components – Providing support for the development of systems as assemblies of components – Supporting the development of components as reusable units – Facilitating the maintenance and evolution of systems by customizing and replacing their components • Component-based Software Engineering – Provides methods and tools supporting different aspects of component-based approach • Process issues, organizational and management issues, technologies (for example component models), theories (component compositions), tools… 10/29/2021
6 Why component-based approach? • Advantages from the business point of view: – Shorter time-to-market, lower development and maintenance costs • Advantages from technical and engineering point of view – Increased understability of (complex) systems – Increased the reusability, interoperability, flexibility, adaptability, dependability… • Advantages from strategic point of view of a society – Increasing software market, generation of new companies • CB-approach has been successful in many application domains: – Web- and internet-based applications – Desktop and office applications, Graphical tools, GUI-based applications – In certain segments of telecommunication, consumer electronics… 10/29/2021
7 CBSE – basic definitions • • • The basis is the Components can be assembled according to the rules specified by the component model Components are assembled through their interfaces A Component Composition is the process of assembling components to form an assembly, a larger component or an application Component are performing in the context of a component framework A component technology is a concrete implementation of a component model 10/29/2021 c 2 Middleware Run-time system Component Model framework
Component Technology Tool g n i t r o p p u S S s ent pon Com m tf or Pla work e m a r ent F n o p Com Repository 10/29/2021 8
9 Implications of the CBSE approach • Component development is separated from system development process – Less programming efforts to build systems – System verification and validation more difficult and more important – Different requirements management • A combination of a bottom-up and top-down approach • Many explicit and implicit assumptions – Architectural styles (middleware, deployment, . . ) 10/29/2021
10 Software Component Definition Szyperski (Component Software beyond OO programming) • A software component is – a unit of composition – with contractually specified interfaces – and explicit context dependencies only. • A software component – can be deployed independently – it is subject to composition by third party. 10/29/2021
11 Another definition • A software component is a software element that – confirms a component model – can be independently deployed – composed without modification according to a composition standard. • A component model defines specific interaction and composition standards. G. Heineman, W. Councel, Component-based software engineering, putting the peaces together, Addoson Wesley, 2001 10/29/2021
12 Implications of Szyperski’s Definition • The following implications arise as a result of Szyperski’s definition: – For a component to be deployed independently, a clear distinction from its environment and other components is required. – A component must have clearly specified interfaces. – The implementation must be encapsulated in the component and is not directly reachable from the environment. (Black box nature) 10/29/2021
13 Component specification • Components are described by their interfaces • (A black box character) white box black box grey box gray glass box 10/29/2021
14 Components and Interfaces - UML definition Component – a set of interfaces required (in-interfaces) provided (out-interfaces) Interface – set of operations Operations – input and output parameters of certain type 10/29/2021
15 IDL Example interface ISpell. Check : IUnknown { HRESULT check([in] BSTR *word, [out] bool *correct); }; interface ICustom. Spell. Check : IUnknown { HRESULT add([in] BSTR *word); HRESULT remove([in] BSTR *word); }; library Spell. Checker. Lib { coclass Spell. Checker { [default] interface ISpell. Check; interface ICustom. Spell. Check; }; }; 10/29/2021
Contractually specified interfaces • Extension of Interface (adding contract) – a set of interfaces that each consists of a set of operations. – a set of preconditions and postconditions is associated with each operation. – A set of invariants • Also called: Contractually specified interfaces 10/29/2021 16
17 Precondition, Postconditions, Invariants • Precondition – – • Postcondition – – • an assertion that the component assumes to be fulfilled before an operation is invoked. Will in general be a predicate over the operation’s input parameters and this state An assertion that the component guarantees will hold just after an operation has been invoked, provided the operation’s pre-conditions were true when it was invoked. Is a predicate over both input and output parameters as well as the state just before the invocation and just after Invariant – Is a predicate over the interface’s state model that will always hold 10/29/2021
18 Semantic Specification in a UML metamodel 10/29/2021
20 Extrafunctional properties • Extrafunctional (non-functional) properties – runt-time properties • Performance, latency • Dependability (Reliability, robustness, safety) – Lifecycle properties • Maintainability, usability, portability, testability, …. • There is no standards for specification of extrafunctional properties 10/29/2021
21 Extrafunctional properties specifications Credentials (Mary Shaw) • A Credential is a triple <Attribute, Value, Credibility> – – – • Attributes in. NET – • Attribute: is a description of a property of a component Value: is a measure of that property Credibility: is a description of how the measure has been obtained A component developer can associate attribute values with a component and define new attributes by sub-classing an existing attribute class. ADL Uni. Con – allows association of <Attribute, Value> to components 10/29/2021
22 Extra-functional Properties 10/29/2021
23 Main principles of CBSE: (1) Reusability • Reusing components in different systems C 1 • The desire to reuse a component poses few technical constraints. • Good documentation (component specification…) • a well-organized reuse process • Similar architecture • …. C 1 C 2 C 1 C 5 C 3 C 4 C 6 C 7 Application A 1 10/29/2021 Application A 2
24 Main principles: (2) Substitutability • • • Alternative implementations of a component may be used. The system should meet its requirements irrespective of which component is used. Substitution principles C 1 C 2 C 3 C 4 Application A 1 – Function level – Non-functional level • Added technical challenges – Design-time: precise definition of interfaces & specification – Run-time: replacement mechanism C 1´ C 2 C 3 C 4 Application A 1 10/29/2021
25 Substitution • Substituting a component Y for a component X is said to be safe if: – All systems that work with X will also work with Y • From a syntactic viewpoint, a component can safely be replaced if: – The new component implements at least the same interfaces as the older components • From semantic point of view? – Contractual interface holds (pre-, postconditions and invariants) 10/29/2021
26 Main principles: (3) Extensibility • Comes in two flavors: C 1 C 2 C 3 C 1 C 2+ C 3 C 1 C 2 C 3 – extending components that are part of a system – Increase the functionality of individual components • Added technical challenges: – Design-time: extensible architecture – Run-time: mechanism for discovering new functionality C 1 10/29/2021 C 2 C 4 C 3
27 Main principles: (4) Composability • Composition of components – P(c 1 o c 2) =P 1(c 1) o P 2(c 2) C C 1 – Composition of functions – Composition of extra-functional properties • Many challenges – How to reason about a system composed from components? • Different type of properties • Different principles of compositions 10/29/2021 assembly C 2
28 Components for Embedded Systems 10/29/2021
29 Do existing component technologies meet the requirements of different domains? • Widely-used component models (Microsoft COM/DCOM and. NET, Sun EJB, OMG CCB, …) – Focus on functionality, flexibility, run-time adaptability, simpler development and maintenance – Do not consider a number of extra-functional requirements • Timing properties (performance), resource consumptions • Reliability, availability, quality of services… Important questions for CBSE feasibility: • Which are the primary requirements in different domains? • Can CBSE provide solutions that meet these requirements? 10/29/2021
30 What are embedded systems? An Embedded Computer System: A computer system that is part of a larger system and performs some of the requirements of that system. (IEEE, 1992). 99, 8% of computer systems are embedded systems (DARPA 2000) 10/29/2021
Characteristics of ES: Interaction with the environment An embedded system interacts with the environment via sensors and actuators A sensor transforms physical data (temperature, pressure) to digital format Examples: thermometer, microphone, video camera • An actuator works the other way round transforming digital data to physical format. Example: motors, pumps, machines… RT software system 10/29/2021 Sensor Actuator Process 31
32 ES – Real-time systems RT Systems : Correct result at the right time Example: An air bag must not be inflated too late, not too early! Collision Too early Too late time In some cases the system must wait before it responds! 10/29/2021
33 Real-time in Football - Offside rules 10/29/2021
34 Too late 10/29/2021
35 Too eraly 10/29/2021
36 Challenges when constructing RT ES Most of the real-time systems are based on following: 1. Several parallel activities are given some unique priorities 2. A resource manager makes sure the task with the highest priority will execute ready Activities 1 ready Resource manager 3 2 CPU 1 3 time Processing requires resources (time, CPU-time, memory, . . ) 10/29/2021
37 Enough resources vs. Limited resources Enough resources – You can always guarantee that all functions in the system are able to execute when they so desire. – Most often safety critical applications – Expensive – Example: ABS-system, ”fly-by-wire”-system, power plant… Limited resources – There may be occasions when the system is unable to handle all functions that wants to execute. – Designed to work well under normal conditions. – Example: telephone – everybody wants to make a phone call simultaneously will result in that some has to wait. 10/29/2021
38 Event driven vs. time driven systems Event driven real-time systems – External events determines when a program is to be executed – Often through interrupts – Example: telephone switches, ”video-on-demand”, transaction systems… Time driven real-time systems – The system handles external events at predefined points in time – Most often cyclic systems repeats a certain scenario – Example: ABS, control systems, manufacturing systems… 10/29/2021
39 Hard vs. Soft real-time systems Hard real-time systems – The cost for not fulfilling the functional and temporal constraints are severe – Failing to meet hard real-time constraints results in computations, at best, being useless – Often safety critical the correctness must be verified before system operation – Example: ABS, airbag, defence system, power plant… Soft real-time systems – Occasional miss of fulfilling a timing constraint can be acceptable – The usefulness of the computation is reduced (reduced service) Example: reservation systems, ATM machines, multimedia, virtual reality… 10/29/2021
40 • New requirements (RT requirements) introduce new challenges in achieving the CBSE principles • Example: – Substitution principle for RT components. 10/29/2021
41 Substitution principles • When we can replace a component? • Goal: on-line upgrade task components in a ‘safe’ way • Two issues: – new components must not be faulty – schedulability of all tasks (components) must be guaranteed • Run-time upgrade possible if worst case execution time – WCET (new comp) ≤ WCET (old comp) • Is that correct? 10/29/2021
42 Example 1: preemptive Fast priority scheduling task priority A high B C rel(B) rel(A, C) dl(B) dl(A, C) medium low A (a) B A is replaced by A’; A’ rel(B) C B dl(B) dl(A, C) C Order of execution changed – deadline met 10/29/2021 dl = deadline wcet(A’)<wcet(A) rel(A, C) (b) C Rel = release time
43 Example 2: non-preemptive FPS task priority A high B C rel(B) rel(A, C) medium dl(B) dl(A, C) low A (a) A is replaced by A’; rel(A, C) (b) 10/29/2021 A’ B C wcet(A’)<wcet(A) rel(B) dll(B) C B misses deadline! B dl(A, C)
44 Example of an embedded system: The architecture of a car control system Infotaiment gateway (CAN) BUS ECU brake Sensor Actuator Sensor ECU injection Sensor Actuator Sensor ECU Sensor Actuator Sensor Vehicle mechanics ECU – Electronic Control Unit 10/29/2021
45 The architectural design challenge Vehicle stability Suspension Local Control Functions Sensor Actuator Drive by wire …… Local Control Functions Sensor Complex functions Basic functions Actuator How to implement complex functions based on local control functions? 10/29/2021
46 Problem: resource sharing Network resources Execution resources Sensor 1 +++++ Node 1 Actuator 1 Sensor 2 Node 2 Actuator 2 Sensor 3 +++++ Node 3 Actuator 3 Sensor. . Node … Actuator … Sensor. . +++++ Node … Actuator … Can functions of different criticality be allowed to share resources? 10/29/2021
47 Challenge – open and dependable platform Antispin Collision detection Global (complex) functions Cruise control Vehicle stability Engine Control Local brake Control Transmission local ……… sensors actuators Vehicle Applications Middleware Input/output drivers Hardware 10/29/2021 ECU ECU SOFTWARE COMPONENTS
48 Challenge – open and dependable platform Applications C 1 C 2 Middleware Input/output drivers Hardware Requirements Separation of hw from SW development Separation of SW component development 10/29/2021 ECU ECU
49 Specific requirements of embedded systems • Real-time requirements • Resource consumption – CPU, Memory, Power, Physical space • Dependability – Safety, reliability, availability • Life-cycle properties (long life systems) – Maintainability, expandability – Portability • Increasing interoperability 10/29/2021
50 Basic concepts for Component-based Embedded Systems • Main concern – Predictability of different properties (on account of flexibility) • Difference between small and systems 10/29/2021 large embedded
51 Unit of composition and independent deployment • Run-time composition – Component lifecycle, – Run-time environment, – Dynamic composition (late binding) Component technology • Configuration composition – Capable of generating monolithic firmware from component-based design, More feasible for – Optimization embedded systems • Re-configuration of the components • Direct references 10/29/2021
52 Explicit context dependencies • Other components and interfaces – required & provided interfaces – (Contractual-based interfaces) Component technology • Run-time environment – – CPU, RTOS, Resource constraints Component implementation language 10/29/2021 Embedded systems specific
53 Component granularity • Coarse-grained components – – – “Bags” with many (partially unused) functions Not resource-usage aware Often distributed components Component technology • Fine-grained components – unneeded functionality removed, – Scarcer uses of resources 10/29/2021 More feasible for embedded systems
54 Framework Composition environment Component Repository 10/29/2021 Run-time environment
55 The day after tomorrow… – Requirements on flexible upgrading • Part of a system • Updating software components • Separation of software from hardware Binary standards will become important 10/29/2021
56 • In most cases the general-purpose component models will not be appropriate for embedded systems • However other component-based approach is appealing ! 10/29/2021
57 Component-based approach for LARGE embedded systems • the resource constraints are not the primary concerns. • The complexity and interoperability important • Minimizing the development costs • For this reason general-purpose component technologies are of more interest than in a case for small systems. 10/29/2021
58 Widely-used component models and embedded systems • Direct use of component models – CORBA (telecommunication) – COM/DCOM, . NET – process industry • Improved component-models (with added functionalities) – OPC (OLE process control Foundation) • Restricted (use of) component-models to achieve predictability – Using only specification (IDL) , no multiple interface, etc. 10/29/2021
70 Some examples of component models 10/29/2021
71 The Koala Component Model – Philips CE Koala is: - a Software Component Model - with an ADL - to build populations of resource constrained products CC C 1 C 2 10/29/2021 C 3
72 Pecos component model (ABB) Property Port key value type Direction range Property. Bundle name scheduling memory Connector Component name event info Event component Active component thread info 10/29/2021 type Subcomponents passive component
73 Save. Comp Model - Md. H 10/29/2021
74 Conclusion & Summary • There is a visible trend in acquiring CB approach in development of embedded systems • New component technologoes and utilization of the existing theories important. 10/29/2021
- Slides: 62