C. Giannelli (Ed.): Mobilware, LNICST 0007, pp. 366–380, 2009. Design, Implementation and Case Study of WISEMAN: WIreless Sensors Employing Mobile AgeNts Sergio González-Valenzuela, Min Chen, and Victor C.M. Leung Department of Electrical and Computer Engineering The University of British Columbia 2332 Main Mall, Vancouver BC, V6Z1T4, Canada {sergiog,minchen,vleung}@ece.ubc.ca Abstract. We describe the practical implementation of Wiseman: our proposed scheme for running mobile agents in Wireless Sensor Networks. Wiseman’s ar- chitecture derives from a much earlier agent system originally conceived for distributed process coordination in wired networks. Given the memory con- straints associated with small sensor devices, we revised the architecture of the original agent system to make it applicable to this type of networks. Agents are programmed as compact text scripts that are interpreted at the sensor nodes. Wiseman is currently implemented in TinyOS ver. 1, its binary image occupies 19Kbytes of ROM memory, and it occupies 3Kbytes of RAM to operate. We describe the rationale behind Wiseman’s interpreter architecture and unique programming features that can help reduce packet overhead in sensor networks. In addition, we gauge the proposed system’s efficiency in terms of task duration with different network topologies through a case study that involves an early-fire-detection application in a fictitious forest setting. Keywords: Mobile agents, wireless sensor networks, performance evaluation. 1 Introduction The topic of Wireless Sensor Networks (WSN) continues to draw significant research interest at present. These investigations include studies on the feasibility of dynami- cally re-tasking sensor nodes in the face of continuous changes in the underlying environment. To tackle this issue, code mobility can be used as a potentially efficient approach [1]. While some of these approaches have been proposed for operation over devices with plentiful hardware resources, we are rather interested in the type of agent-based re-tasking systems targeted at low-end sensor devices that are character- ized by severe memory and processing constraints. The main motivation for studying WSN agent-based re-tasking is that it enables rapid modifications to the pre- programmed behaviour of sensor nodes responding to a predefined type of events. Clearly, dynamic WSN re-tasking provides flexibility and convenience to its opera- tors. Still, further studies are needed to determine whether this mechanism is not only practicable from an engineering perspective, but also whether the system that imple- ments it fulfills performance expectations in terms of resources employed and response time. c I nstitute for Computer Science, Social Informatics and Telecommunications Engineering 2009 I CST The original version of this chapter was revised: The copyright line was incorrect. This has been corrected. The Erratum to this chapter is available at DOI: 10.1007/978-3-642-01802-2 30