skip to main content
10.1145/1978642.1978653acmotherconferencesArticle/Chapter ViewAbstractPublication PageshotemnetsConference Proceedingsconference-collections
research-article

Threads2Events: an automatic code generation approach

Published: 28 June 2010 Publication History

Abstract

There is a long-standing dispute on whether and when thread-based programming should be preferred over the event-based paradigm. This dispute has also extended into the wireless sensor networks domain. Many existing operating systems rely on events due to their efficiency, but make code management difficult. Others rely on threads for developer comfort, but at the cost of reduced runtime efficiency. In this paper we try to combine the best of both worlds by offering a full-fledged cooperative thread abstraction with blocking I/O to the C programmer that is compiled into efficient event-based code. We present the basic code transformations and investigate their efficiency using a representative application case study. We find that RAM usage of generated code competes with hand-written code, but further optimizations are required to reduce the code size and the number of CPU cycles.

References

[1]
A. Adya, J. Howell, M. Theimer, W. J. Bolosky, and J. R. Douceur. Cooperative task management without manual stack management. In Proc. of the 2002 USENIX Annual Technical Conference, pages 289--302, June 2002.
[2]
S. Bhatti, J. Carlson, H. Dai, J. Deng, J. Rose, A. Sheth, B. Shucker, C. Gruenwald, A. Torgerson, and R. Han. Mantis OS: An embedded multithreaded operating system for wireless micro sensor platforms. Mobile Networks & Applications, 10:563--579, August 2005.
[3]
N. Brouwers, P. Corke, and K. Langendoen. Darjeeling: a java compatible virtual machine for microcontrollers. In Proc. of the ACM/IFIP/USENIX Middleware 2008 Conference Companion (Companion 2008), pages 18--23, December 2008.
[4]
C. Duffy, U. Roedig, J. Herbert, and C. J. Sreenan. Adding Preemption to TinyOS. In Proceedings of the 4th workshop on Embedded networked sensors (EmNets 2007), pages 88--92, December 2007.
[5]
A. Dunkels, B. Gronvall, and T. Voigt. Contiki - A Lightweight and Flexible Operating System for Tiny Networked Sensors. In Proc. of the 29th Annual IEEE Intl. Conf. on Local Computer Networks (LCN'04), pages 455--462, November 2004.
[6]
A. Dunkels, O. Schmidt, T. Voigt, and M. Ali. Protothreads: Simplifying Event-Driven Programming of Memory-Constrained Embedded Systems. In Proc. of the 4th Intl. Conf. on Embedded Networked Sensor Systems (SenSys'06), pages 29--42, October 2006.
[7]
J. Hill, R. Szewczyk, A. Woo, S. Hollar, D. Culler, and K. Pister. System architecture directions for networked sensors. SIGPLAN Notices, 35(11):93--104, November 2000.
[8]
K. Klues, C.-J. M. Liang, J. Paek, R. Musăloiu-E, P. Levis, A. Terzis, and R. Govindan. TOSThreads: Thread-Safe and Non-Invasive Preemption in TinyOS. In Proceedings of the 7th ACM Conference on Embedded Networked Sensor Systems (SenSys'09), pages 127--140, New York, NY, USA, 2009. ACM.
[9]
W. P. McCartney and N. Sridhar. Abstractions for Safe Concurrent Programming in Networked Embedded Systems. In Proc. of the 4th Intl. Conf. on Embedded Networked Sensor Systems (SenSys'06), pages 167--180, October 2006.
[10]
C. Nitta, R. Pandey, and Y. Ramin. Y-threads: Supporting concurrency in wireless sensor networks. In Proc. of the Intl. Conf. on Distributed Computing in Sensor Systems (DCOSS'06), pages 169--184, June 2006.
[11]
J. Sallai, M. Maróti, and A. Lédeczi. A concurrency abstraction for reliable sensor network applications. In Proceedings of the 12th Monterey conference on Reliable systems on unreliable networked platforms, pages 143--160, Berlin, Heidelberg, 2007. Springer-Verlag.

Cited By

View all
  • (2015)Stackless Multi-Threading for Embedded SystemsIEEE Transactions on Computers10.1109/TC.2014.237825664:10(2940-2952)Online publication date: 1-Oct-2015
  • (2011)Stackless preemptive multi-threading for TinyOS2011 International Conference on Distributed Computing in Sensor Systems and Workshops (DCOSS)10.1109/DCOSS.2011.5982136(1-8)Online publication date: Jun-2011

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Other conferences
HotEmNets '10: Proceedings of the 6th Workshop on Hot Topics in Embedded Networked Sensors
June 2010
89 pages
ISBN:9781450302654
DOI:10.1145/1978642
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

  • CITI: Cork Institute of Technology

In-Cooperation

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 28 June 2010

Permissions

Request permissions for this article.

Check for updates

Qualifiers

  • Research-article

Funding Sources

Conference

HotEMNETS'10
Sponsor:
  • CITI

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)0
  • Downloads (Last 6 weeks)0
Reflects downloads up to 15 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2015)Stackless Multi-Threading for Embedded SystemsIEEE Transactions on Computers10.1109/TC.2014.237825664:10(2940-2952)Online publication date: 1-Oct-2015
  • (2011)Stackless preemptive multi-threading for TinyOS2011 International Conference on Distributed Computing in Sensor Systems and Workshops (DCOSS)10.1109/DCOSS.2011.5982136(1-8)Online publication date: Jun-2011

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media