nAIT: A source analysis and instrumentation framework for nesC

https://doi.org/10.1016/j.jss.2009.01.011Get rights and content

Abstract

Automated software engineering methods support the construction, maintenance, and analysis of both new and legacy systems. Their application is commonplace in desktop- and enterprise-class systems due to the productivity and reliability benefits they afford. The contribution of this article is to present an applied foundation for extending the use of such methods to the flourishing domain of wireless sensor networks. The objective is to enable developers to construct tools that aid in understanding both the static and dynamic properties of reactive, event-based systems. We present a static analysis and instrumentation toolkit for the nesC language, the defacto standard for sensor network development. We highlight the novel aspects of the toolkit, analyze its performance, and provide representative case-studies that illustrate its use.

Introduction

For desktop- and enterprise-class system developers, automated software engineering methods have become important elements of the standard development arsenal. Automation tools increase developer productivity, improve the reliability of new systems, and safeguard the reliability of legacy systems undergoing maintenance and evolution. The focus of this article is restricted to automated analysis and instrumentation methods. Even limited to this subset, however, automation benefits span a disparate range of tasks. Tools assist developers in reasoning about reference relationships, extracting diagrammatic source representations (Liang and Harrold, 1999, Rountev et al., 2001, Tonella and Potrich, 2001, Tonella and Potrich, 2003, Guéhéneuc, 2004, Sridharan and Bodı´k, 2006), visualizing runtime behavior (Van Put et al., 2005, Systä et al., 2001, Jerding et al., 1997), optimizing performance (Johnson et al., 2004, Pereira et al., 2001), and understanding the behavior of malicious code (Vasudevan and Yerraballi, 2006). Indeed, the benefits are numerous, extending far beyond this short list.

To facilitate the construction of such tools, a number of supporting library packages have been developed (Lindlan et al., 2000, Bodin et al., 1994, Wong, 1996). These packages provide common analysis and instrumentation services and expose those services in a manner that simplifies and expedites the construction of other tools. A tool developer might, for instance, use such a package to retrieve the abstract semantic graph corresponding to a given program. This structure might then be used as the basis for implementing points-to analyses that identify the memory locations that may be affected by the execution of a given program statement. (Side-effect analysis tools of this type are especially valuable during system maintenance and evolution.) Program comprehension benefits could then be further amplified: Instrumentation services provided by the supporting library could be used to inject logging probes at key system execution points. The logged data could be used to reverse-engineer UML sequence diagrams, correlate state modifications, or visualize control flow. The key point is that a wide range of tasks can be simplified by using a library package that provides general-purpose analysis and instrumentation services – a well-recognized fact.

The point of departure for our work is the observation that while a number of analysis and instrumentation toolkits exist for languages like C, C++, and Java, there are no analogous efforts for languages tailored for sensor network development. The principal contribution of our work is to address this significant gap. Our focus is on the nesC language (Gay et al., 2003, Levis, 2006), the emerging standard for sensor network development.

But why concentrate on sensor networks? The focus is motivated by the burgeoning academic and commercial interest in these systems. Each is composed of tiny computing devices – ranging from the size of a matchbox to the size of a quarter – that sense, process, and communicate environmental stimuli. When deployed in large numbers, they serve as key enablers of the ubiquitous computing vision, creating a transparent compute fabric that can be installed across diverse environments. These systems are already transforming the way we coordinate with our peers (Laibowitz et al., 2006, Aylward et al., 2006), study the ecology of our planet (Hu et al., 2005, Tolle et al., 2005, Werner-Allen et al., 2006, Musăloiu, 2006), monitor our civil infrastructure (Glaser, 2004, Chintalapudi et al., 2006), and protect our communities (Simon et al., 2004, Arora et al., 2005, Tolliver et al., 2006). In short, sensor networks have the potential to have a profound impact on human experience.

Despite the rapid evolution of sensor network language and runtime platforms, few software engineering tools are available to help developers build, maintain, validate, and comprehend program implementations. The absence of such tools is likely to be an important factor contributing to the notorious difficulty of constructing and maintaining these systems, and the unexpected behaviors that are often exhibited in deployed networks. To enable the development of such tools and to enhance programmer productivity and system reliability, we present a general-purpose analysis and instrumentation toolkit designed for the nesC language. The intent is to provide a catalyst for extending the benefits of automated software engineering to this exciting new domain.

Before proceeding, it is natural to question whether a custom toolkit is required. Is it not possible to adapt an existing set of tools? Our answer to this question is no. The nesC language is fundamentally different from existing imperative languages due to the resource limitations of target hardware platforms and the unique requirements of sensor network applications. The analysis and instrumentation techniques embodied in existing toolkits simply do not apply. We return to this point in Section 2, where we highlight the main features of nesC by contrast to more traditional languages.

The contributions of this article are as follows. First, we present the design and implementation of an analysis and instrumentation toolkit for nesC, the defacto standard programming language used in sensor network development. This is the first such toolkit to be described for any sensor network programming platform. Second, we present two case-studies that demonstrate the utility of the toolkit in performing common analysis and instrumentation tasks. The first involves the construction of a debugging tool that provides services for monitoring state predicates that span module boundaries. The second involves the construction of a reverse-engineering system for producing UML sequence diagrams corresponding to particular program runs. Finally, we present a detailed analysis of the toolkit’s runtime performance characteristics and memory usage.

In Section 2, we present a brief overview of the nesC language, with an emphasis on the points of novelty that preclude the application of existing analysis and instrumentation techniques. In Section 3, we present the design and implementation of the new toolkit. Section 4 presents the toolkit case-studies. A detailed quantitative analysis is presented in Section 5. Section 6 summarizes some of the most important elements of related work. We conclude in Section 7 with a summary of contributions and pointers to future work.

Section snippets

nesC and TinyOS

nesC (for “Network Embedded Systems C” (Gay et al., 2003, Levis, 2006)) is a component-based dialect of the C programming language tailored for developing embedded network systems. While the application possibilities are numerous, the language is most commonly used in constructing wireless sensor network applications and is emerging as the development standard in this domain. There are hundreds (or perhaps thousands) of documented projects, both academic and commercial, involving the use of

Toolkit design and implementation

The nesC Analysis and Instrumentation Toolkit (nAIT) provides a foundation for extending the use of automated software engineering methods to the domain of wireless sensor networks. The following subsections describe our design goals and the implementation of the toolkit.

Use-case scenarios

We now consider two use-case scenarios that illustrate the features and benefits of the nAIT design and outline how the toolkit’s traversal, modification, and generation methods are used to develop new source-based software engineering tools for nesC. The first use-case describes the development of a source-based state predicate evaluation tool. The second describes the development of a runtime trace recording and visualization tool.

Quantitative analysis

We now examine the nAIT’s resource requirements. We focus on the time required to load, traverse, and instantiate (in the case of generics) ASTs. We also study the memory required to represent ASTs. Applications included as part of the standard TinyOS distribution are used as the test suite.

All experiments were conducted on an Intel Pentium 4 processor running at 2.8 GHz with hyperthreading technology and 2 GB of main memory. The hosting operating system was GNU/Linux 2.6.23 (Gentoo) with

Related work

The difficulties associated with developing flexible analysis and instrumentation libraries are well-recognized. In the domain of imperative programming languages, a number of solutions have been proposed to reduce these difficulties. The solutions target object-, intermediate-, and source-level program representations. Recall that these solutions are inapplicable to nesC because of its unique features, including synchronous and asynchronous events, tasks, component wirings, and fanning of

Conclusion

Automated software engineering methods are integral to the development and maintenance of desktop- and enterprise-class systems. The tools that implement these methods are typically developed using libraries that provide common analysis and instrumentation services, and expose those services in a manner that simplifies and expedites tool construction. While many such toolkits exist for languages such as C, C++, and Java, there has been no prior work focused on languages tailored for sensor

Acknowledgements

The work presented in this article was funded in part by grants from the National Science Foundation (CNS-0745846, CNS-0520222). The authors gratefully acknowledge the NSF for its support.

Andrew R. Dalton is an Assistant Professor of Computer Science at Western Carolina University. His primary research interests lie at the intersection of wireless sensor networks, software engineering, and programming languages, with an emphasis on the design and implementation of experimental software systems. Under this umbrella heading, he focuses on tools and techniques for improving the development, maintenance, and comprehension of embedded network systems. Dr. Dalton received the B.S. and

References (57)

  • Arora, A., Ramnath, R., Ertin, E., Sinha, P., Bapat, S., Naik, V., Kulathumani, V., Zhang, H., Cao, H., Sridharan, M.,...
  • Aylward, R., Paradiso, J., 2006. Sensemble: a wireless, compact, multi-user sensor system for interactive dance. In:...
  • Bodin, F., Beckman, P., Gannon, D., Gotwals, J., Narayana, S., Srinivas, S., Winnicka, B., 1994. Sage++: an...
  • Brewer, E., Culler, D., Gay, D., Levis, P., von Behren, R., Welsh, M., 2006. nesC: a programming language for deeply...
  • Bruneton, E., Lenglet, R., Coupaye, T., 2002. ASM: a code manipulation tool to implement adaptable systems. In: The...
  • B. Buck et al.

    An API for runtime code patching

    International Journal of High Performance Computing Applications

    (2000)
  • J. Casmira et al.

    Tracing and characterization of windows NT-based system workloads

    Digital Technical Journal of Digital Equipment Corporation

    (1998)
  • K. Chintalapudi et al.

    Monitoring civil structures with a wireless sensor network

    IEEE Internet Computing

    (2006)
  • Cohen, G.A., Chase, J.S., Kaminsky, D.L., 1998. Automatic program transformation with JOIE. In: The USENIX 1998 Annual...
  • M. Dahm

    Byte code engineering

  • Dalton, A.R., Hallstrom, J.O., 2008. A toolkit for visualizing the runtime behavior of TinyOS applications. In: The...
  • ECMA International, 2006. C# language specification....
  • Ferenc, R., Beszédes Árpád, Tarkiainen, M., Gyimóthy, T., 2002. Columbus – reverse engineering tool and schema for C++....
  • E. Gamma et al.

    Design Patterns: Elements of Reusable Object-Oriented Software

    (1995)
  • Gay, D., Levis, P., von Behren, R., Welsh, M., Brewer, E., Culler, D., 2003. The nesC language: a holistic approach to...
  • Gibbs, T.H., Malloy, B.A., 2003. Weaving aspects into C++ applications for validation of temporal invariants. In: The...
  • Glaser, S., 2004. Some real-world applications of wireless sensor nodes. In: SPIE Symposium on Smart Structures &...
  • Guéhéneuc, Y., 2004. A reverse engineering tool for precise class diagrams. In: The 2004 Conference of the Centre for...
  • Hennessy, M., Malloy, B.A., Power, J.F., 2003. gccXfront: exploiting gcc as a front end for program comprehension tools...
  • Hu, W., Tran, V., Bulusu, N., Chou, C., Jha, S., Taylor, A., 2005. The design and evaluation of a hybrid sensor network...
  • Hudson, S.E., Flannery, F., Ananian, C.S., 2006. CUP: LALR parser generator for java....
  • Jerding, D., Stasko, J., Ball, T., 1997. Visualizing interactions in program executions. In: The 19th International...
  • Johnson, T., Lee, S., Fei, L., Basumallik, A., Upadhyaya, G., Eigenmann, R., Midkiff, S., 2004. Experiences in using...
  • Kagstrom, S., Grahn, H., Lundberg, L., 2005. Automatic low overhead program instrumentation with the LOPI framework....
  • Kiczales, G., Hilsdale, E., Hugunin, J., Kersten, M., Palm, J., Griswold, W.G., 2001. An overview of AspectJ. In:...
  • Klein, G., 2004. JFlex: the fast scanner generator for java....
  • Kraft, N.A., Malloy, B.A., Power, J.F., 2005. g4re: harnessing GCC to reverse engineer C++ applications. In: Cordy, J.,...
  • Laibowitz, M., Gips, J., Aylward, R., Pentland, A., Paradiso, J., 2006. A sensor network for social dynamics. In: The...
  • Cited by (6)

    Andrew R. Dalton is an Assistant Professor of Computer Science at Western Carolina University. His primary research interests lie at the intersection of wireless sensor networks, software engineering, and programming languages, with an emphasis on the design and implementation of experimental software systems. Under this umbrella heading, he focuses on tools and techniques for improving the development, maintenance, and comprehension of embedded network systems. Dr. Dalton received the B.S. and M.S. degrees in Computer Science from Appalachian State University, and worked as a Software Engineer at Nortel Networks before earning the Ph.D. degree in Computer Science at Clemson University.

    Jason O. Hallstrom is an Assistant Professor in the School of Computing at Clemson University. He holds the B.S. and M.A. degrees from Miami University in Systems Analysis and Economics, respectively. He also holds the M.S. and Ph.D. degrees from Ohio State University in Computer and Information Science and has approximately 10 years of industry development experience. His research program spans two tracks. The first is focused on safeguarding the reliability of embedded network systems, from design through maintenance. The second is focused on specification and reasoning issues in the context of pattern-based development. Dr. Hallstrom received an NSF CAREER award in 2008.

    View full text