Middleware for Wireless Sensor Networks Présenté par Andrei Marculescu 1 Plan • • • • Middleware Middleware for WSN Overview of current approaches Classification 2 Middleware – definition (1) • Context : – Distributed systems • Goal : – Help manage complexity and heterogeneity • Location : – Layer between the OS and the application program • OS vs Middleware : – OS makes a hardware useable – Middleware makes a distributed system programmable 3 Middleware – services view (1) • Middleware can be classified in terms of the services provided to applications 4 Middleware – services view (2) • Type of services – Presentation Services • Graphics, forms, printing services – Computation Services • Sorting, math services, time services – Information Services • Directories, log management, shared data – Communication Services • Messaging, procedure calls – Control Services • Transaction, thread management, job scheduling – System Services • Event notification, software installation, authentication 5 Middleware – abstraction view (1) • Distributed Tuples – Shared tuple space – Processes post and read tuples • Unaware of each other’s identities • Examples – Distributed relational databases – Linda (Yale University) – Jini (Sun) + Information, Control 6 Middleware – abstraction view (2) • Remote Procedure Call (RFC 1831) – Possibility to invoke a procedure whose body is accros a network • Example – Sun’s RPC + Communication 7 Middleware – abstraction view (3) • Message-oriented middleware – Message passing and/or queuing • Synchronous vs asynchronous – Facilitates communication between distributed applications • Example – IBM’s WebSphere MQ + Communication 8 Middleware – abstraction view (4) • Distributed Object Middleware – Remote object, whose methods can be invoked like local methods • Examples – CORBA (Common Object Request Broker Architecture) – Java RMI (Remote Method Invocation) – .NET (Remote) + Communication (Computation) Control, Information, System 9 ? Presentation (.NET) Middleware – abstraction view (5) • Service Oriented Middleware – Services become a programming abstraction • Semantically described – Existing services are available through Service directories – New services are available through dynamic service composition • Examples – Web Services (WSDL) + Information, Communication, Computation 10 Middleware – abstraction view (6) • Agent Oriented Middleware – Agents are the programming abstraction – Keywords • Autonomy • Flexibility • Code Mobility • Examples – JADE + All (complex, dynamic systems) 11 Middleware - conclusions • Existing approaches are adapted to distributed systems • Middlewares tend to provide more and more services – Universal tools – Heavy environments • Exceptions exist : CORBA for embedded systems – Agents are used only for a restricted class of problems 12 Plan • • • • Middleware Middleware for WSN Overview of current approaches Classification 13 Middleware for WSN (1) • • • • • Data-centric querying and processing Localized algorithms Limited resources Dynamic network Application knowledge 14 Middleware for WSN (2) • New programming abstractions – Cluster-based • Resource-aware software – Adaptive • Application-aware middleware – Quality of service • Lightweight software – More tightly coupled to the OS ? 15 Plan • • • • Middleware Middleware for WSN Overview of current approaches Classification 16 Current Approaches • Impala • Maté • Querying – TinyDB – SQTL • Sensor Querying and Tasking Language • Generic Role Assignment 17 Impala – overview (1) • Designed for ZebraNet project – mobile sensor network – deployment, management and communications problems • ZebraNet HW – – – – – 32KHz – 8MHz CPU => 9.6 – 19.32 mW 8MHz GPS receiver => 568 mW 8MHz radio xmit => 780 mW 8MHz radio rcv => 312 mW 1 – 8 MB non-volatile storage 18 Impala – overview (2) • Classical approach – Service oriented • Deployment (on-the-fly software updates) • Thread management (application switching) • Event-filtering • Novel approach – Resource-aware, application knowledge • Adaptative – OS-middleware hybrid 19 Impala – system architecture 20 Impala – adaptability • Routing protocols switching – History-based – Flooding 21 Current Approaches • Impala • Maté • Querying – TinyDB – SQTL • Sensor Querying and Tasking Language • Generic Role Assignment 22 Maté - overview • VM approach – Bytecode interpreter on top of TinyOS • Fixed-size instructions (1 byte) • Fixed-size code capsules – 24 instructions – Identifying and version information – A program can contain several capsules • Operand stack and return address stack – Highly optimized resource management • Memory management • Network management 23 Maté – execution model Code capsules Execution contexts Shared variable 24 Maté – instruction set • Assembly language style • Built-in high-level functions – send instruction • Default routing protocol : send • Possible extensions : sendr – code broadcast : forw – Logging : log / logr – Shared variable access : gets / sets – Sensing 25 Maté – example 26 Current Approaches • Impala • Maté • Querying – TinyDB – SQTL • Sensor Querying and Tasking Language • Generic Role Assignment 27 TinyDB - overview • High-level querying – Well-known declarative language – Hides the network • One virtual table with nodes as rows • Every node attribute represents a column – TinySQL language • No neighborhood management – Global spanning tree for queries – Requests are flooded to all nodes Scalability, efficiency ? 28 TinyDB - example SELECT AVERAGE(temp) FROM SENSORS WHERE TEMP > 20 TRIGGER ACTION SetSnd(512) EPOCH DURATION 512 Single table Trigger sound During query Repeat query every 512 ms 29 SQTL - overview • Distributed querying design – Queries are injected into the network – Some queries need coordination – Queries are processed locally by sensor nodes • Distributed tasking capabilities – Collaborative work • Moving vehicle detection 30 SQTL - overview • Meta-language for messages – SQTL Wrapper • New querying and tasking language – SQLT • Sensor execution environment – SEE 31 SQLT Wrapper (1) • Message => (action (:param value)+) Language independent 32 SQLT Wrapper (2) • Example (execute :sender FRONTEND :receiver (:group NODE(1) :criteria TRUE) :application-id 123 :language SQTL :content ( // SQLT code here ) ) 33 SQTL language (1) • Lightweight object oriented language • Event handling primitives (upon) • Communication primitives (tell, receive) • Sensor access primitives (getTempSensor()) 34 SQTL language (2) • Example : SELECT Max(getTemperature()) FROM ALL_NODES 35 SEE • Message demultiplexing • Concurrent execution of several applications 36 Current Approaches • Impala • Maté • Querying – TinyDB – SQTL • Sensor Querying and Tasking Language • Generic Role Assignment 37 Generic Role Assignment (GRA) • Self-organizing network – Nodes • Evaluate their status • Agree on their roles assignment in the network – Developer • Implement role specifications 38 GRA – status evaluation • Based on a property directory (cache) • One directory on each node 39 GRA – role specification • Every nodes have a copy of the same role specification • Role examples – ON / OFF (turning off redundant nodes) – CLUSTERHEAD / GATEWAY / SLAVE (improving data delivery with clustering) – SOURCE / DATA AGGREGATOR / SINK (data aggregation) • A role specification is a list of role-rule pairs ON :: { temp-sensor == true && battery >= threshold && count(2 hops) { role == ON && dist(super.pos, pos) <= sensing-range } <= 1 } OFF :: else 40 GRA – role assignment • Role assignment algorithm – Triggered by property changes – Evaluates rules in the rule specification – If a rule evaluate to true, the associated role is assigned 41 Plan • • • • Middleware Middleware for WSN Overview of current approaches Classification 42 Classification (1) • New important programming abstraction – Cluster based • Distributed VM • Service Oriented Maté VM TinyDB SQTL GRA Cluster based Hood SO Impala 43 Classification (2) • Two levels of middleware – « external » • Global Internet view – Identify services provided by a sensor network – « internal » • Programmer’s view – Identify abstractions that facilitate network programming • Ex. TinyDB tries to merge these two levels 44 Questions ? 45 Bibliographie P. A. Bernstein. Middleware: a model for distributed system services. Communications of the ACM, 39(2):86-98, 1996 K. Römer, O. Kasten, F. Mattern, "Middleware challenges for wireless sensor networks", Mobile Computing and Communications Review, vol. 6, no. 2, 2002 T. Liu and M. Martonosi. Impala: A Middleware System for Managing Autonomic, Parallel Sensor Systems. In ACM SIGPLAN Symp. on Principles and Practice of Parallel Programming (PPoPP), June 2003 P. Levis and D. Culler. Mate: A Tiny Virtual Machine for Sensor Networks. In Proceedings of the 10th International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS-X), Oct. 2002 C. Jaikaeo, C. Srisathapornphat, and C.-C. Shen, "Querying and Tasking in Sensor Networks," SPIE's 14th Annual Int'l. Symp. Aerospace/Defense Sensing, Simulation, and Control, Orlando, FL, Apr. 2000 Frank, C. and Römer, K. 2005. Algorithms for generic role assignment in wireless sensor networks. In Proceedings of the 3rd international Conference on Embedded Networked Sensor Systems (San Diego, California, USA, November 02 - 04, 2005). SenSys '05. ACM Press, New York, NY, 230-242. Terfloth, K., Schiller, J.: "Driving Forces behind Middleware Concepts for Wireless Sensor Networks". Submitted - under review, April 2005 Kamin Whitehouse, Cory Sharp, Eric Brewer, and David Culler. Hood: a neighborhood abstraction for sensor networks. In MobiSYS '04: Proceedings of the 2nd international conference on Mobile systems, applications, and services, pages 99--110. ACM Press, 2004 46