Overview of Prism-MW CS 795 / SWE 699 Sam Malek Spring 2010 Prism-MW A simple and extensible architectural middleware, i.e., a framework of abstract classes for architectural concepts such as (sub)systems, components, connectors, and events. The middleware supports composition of arbitrarily complex components and connectors. Objectives • “Programming” • Architectural abstractions directly reified in the implementation • “Small” • Efficiency demanded by resource constraints • “Many” • Scalability in the numbers of devices, threads, components, connectors, events Extensibility to support awareness, mobility, • reconfigurability, security, delivery guarantees 2 Prism: Programming-in-the-Small-and-Many Prism Challenges Resource constraints Demand highly efficient computation, communication, and memory footprint Demand unorthodox solutions e.g., off-loading components Hardware and software heterogeneity Proprietary operating systems Dialects of programming languages Device-specific data formats Lack of support for inter-device interaction Lack of support for code mobility From architecture to implementation Architectures provide high-level concepts Programming languages provide low-level constructs Components, connectors, ports, events, configurations Variables, arrays, pointers, procedures, objects Bridging the two often is an art-form Middleware can help “split the difference” Existing middleware technologies Support some architectural concepts (e.g., components, events) but not others (e.g., configurations) Impose particular architectural styles End result architectural erosion Architecture does not match the implementation What is needed is “architectural middleware” Prism-MW An architectural middleware for embedded systems Supports architecture-based software development Efficient Scalable Flexible and Extensible Architecture-based software development is the implementation of a software system in terms of its architectural elements Allows us to cope with heterogeneity Supports arbitrary complex architectural styles Architectural Middleware Natively support architectural concepts as middleware constructs Include system design support Support round-trip development From architecture to implementation and back Support automated transformation of architectural models to implementations Typically via an accompanying ADL and analysis tools i.e., dependable implementation Examples ArchJava Aura c2.fw Prism-MW Prism-MW Round Robin Dispatcher Fifo Scheduler Abstract Dispatcher Abstract Monitor Scaffold Serializable Abstract Scheduler Extensible Event Event Brick Architecture Port Abstract Event Extensions Connector Extensible Port ... Extensible Architecture IPort #mutualPort IComponent Abstract Implementation Extensible Component Abstract Awareness ... Awareness Extensions Component Extensible Connector Abstract Port Extensions ... Application Specific Impl. IConnector IArchitecture ... Abstract Topology Abstract Comp Behavior Abstract Handler Abstract Conn Behavior Prism-MW Serializable Fifo Scheduler Abstract Scheduler Round Robin Dispatcher Abstract Dispatcher Brick Scaffold Event IPort #mutualPort Architecture Port IComponent IConnector Component IArchitecture Connector Extensible Component Using Prism-MW Component A Component B Connector C C Component D class DemoArch { static public void main(String argv[]) { Architecture arch = new Architecture ("DEMO"); // create components ComponentA a = new ComponentA ("A"); ComponentB b = new ComponentB ("B"); ComponentD d = new ComponentD ("D"); // create connectors Connector conn = new Connector("C"); // add components and connectors arch.addComponent(a); arch.addComponent(b); arch.addComponent(d); arch.addConnector(conn); Architecture - DEMO Component A Component B Component D } } // establish the interconnections arch.weld(a, conn); arch.weld(b, conn); Connector C C arch.weld(conn, d) Using Prism-MW Component A Component B Send (e1) Component D sends an event Event e = new Event ("Event_D"); e.addParameter("param_1", p1); send (e); Component B handles the event and sends a response Connector C C Send (e) Component D Architecture - DEMO public void handle(Event e) { if (e.equals("Event_D")) { ... Event e1= new Event("Response_to_D"); e1.addParameter("response", resp); send(e1); }... } Event Dispatching Thread Pool Scaffold Adaptation of an existing worker Component B B thread pool technique Component handle Event E2 Component A E 2Network Connector C send Event Topology based routing Single event queue for both locally and remotely generated events Easy redeployment and E E X X E E E E 3 4 5 redistribution 1of2 applications onto different hardware configurations Component D E Prism-MW Performance Efficiency • 1750 SLOC • 4600 B for the core • 160 B per component • 240 B per connector • 70 B per weld • 160 B per event • 240 B per event parameter Scalability • Numbers of devices, threads and events not limited by Prism-MW • Numbers of components and connectors available_memory – middleware_size average_element_size … 100 001 components 100 000 connectors Total event roundtrip time 2.7 sec Prism-MW Benchmarks on a PC 3000 2500 2000 1500 T i me ( ms ) 1000 500 0 N u mb e r o f c o mp o n e n t s 100 50 10 1 1 100 1000 10000 100000 N u mb e r o f e v e n t s 1E +05 10000 1000 100 1 100 2674 300 50 20 20 50 1843 211 40 20 10 10 1222 150 30 11 10 1 1081 131 30 10 1 Prism-MW has been adopted by several industry partners Troops Deployment Simulation US Army MIDAS Bosch Research and Technology Center Architecture of MIDAS PDA Architecture Gateway Architecture Service-Oriented Sub-Architecture FileInput Svc Trouble LogSvc Topology Calculator EventNotificat ionSvc Hub Operator Pub-Sub Conn To other PDAs Unicast Conn Admin Pub-Sub Conn Admin To other gateways Peer-to-Peer Sub-Architecture EventDisplay To other gateways GwToGw Processor SDEngine Pub-Sub Conn To sensors Sensor Processor Pub-Sub Conn Session Administrator SDEngine SDEngine Pub-Sub Conn GwToHub Processor Session Operator Publish-Subscribe Sub-Architecture NodeInfo Svc Hub Architecture Deployer Legend: Prism-MW Architecture Component Meta-level Comp Request Port Reply Port Distribution Request Port Service Distribution Reply Port Connector Pointer Recent Progress