skip to main content
10.1145/1244381.1244403acmconferencesArticle/Chapter ViewAbstractPublication PagespepmConference Proceedingsconference-collections
Article

Tasks: language support for event-driven programming

Published:15 January 2007Publication History

ABSTRACT

The event-driven programming style is pervasive as an efficient method for interacting with the environment. Unfortunately, the event-driven style severely complicates program maintenance and understanding, as it requires each logical flow of control to be fragmented across multiple independent callbacks.

We propose tasks as a new programming model for organizing event-driven programs. Tasks are a variant of cooperative multi-threading and allow each logical control flow to be modularized in the traditional manner, including usage of standard control mechanisms like procedures and exceptions. At the same time, by using method annotations, task-based programs can be automatically and modularly translated into efficient event-based code, using a form of continuation passing style (CPS) translation. A linkable scheduler architecture permits tasks to be used in many different contexts.

We have instantiated our model as a backward-compatible extension to Java, called TaskJava. We illustrate the benefits of our language through a formalization in an extension to Featherweight Java, and through a case study based on an open-source web server.

References

  1. A. Adya, J. Howell, M. Theimer, W. J. Bolosky, and J. R. Douceur. Cooperative task management without manual stack management. In Proc. Usenix Tech. Conf., 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. A. Appel. Compiling with continuations. Cambridge University Press, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Enterprise Java Beans, http://java.sun.com/products/ejb/.Google ScholarGoogle Scholar
  4. David Bond. Fizmez web server. http://sourceforge.net/projects/fizmezwebserver.Google ScholarGoogle Scholar
  5. R. Engelschall. Portable multithreading - the signal stack trick for user-space thread creation. In Proc. USENIX Tech. Conf., June 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. J. Fischer, R. Majumdar, and T. Millstein. Preventing lost messages in event-driven programming, January 2006. http://www.cs.ucla.edu/tech-report/2006-reports/060001.pdf.Google ScholarGoogle Scholar
  7. S. Ganz, D. Friedman, and M. Wand. Trampolined style. In ICFP '99, pages 18--27, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. D. Gay, P. Levis, R. von Behren, M. Welsh, E. Brewer, and D. Culler. The nesC Language: A Holistic Approach to Network Embedded Systems. In PLDI '03, pages 1--11, June 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. P. Graunke, S. Krishnamurthi, S. Van Der Hoeven, and M. Felleisen. Programming the web with high-level programming languages. LNCS, 2028:122--137, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. J. Hill, R. Szewczyk, A. Woo, S. Hollar, D. Culler, and K. Pister. System architecture directions for networked sensors. In ASPLOS '00, pages 93--104. ACM, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. A. Igarashi, B. Pierce, and P. Wadler. Featherweight java: a minimal core calculus for java and gj. ACM Trans. Program. Lang. Syst., 23(3):396--450, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. M. Krohn, E. Kohler, F. Kaashoek, and D. Mazieres. The Tame event-driven framework. http://www.okws.org/doku.php?id=okws:tame.Google ScholarGoogle Scholar
  13. P. Li and S. Zdancewic. Advanced control flow in java card programming. In LCTES '04, pages 165--174. ACM Press, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. J. Matthews, R. Findler, P. Graunke, S. Krishnamurthi, and M. Felleisen. Automatically restructuring programs for the web. Automated Software Eng., 11(4):337--364, October 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. N. Nystrom, M. R. Clarkson, and A. C. Myers. Polyglot: An extensible compiler framework for java. In CC '03, LNCS 2622, pages 138--152. Springer, 2003.Google ScholarGoogle ScholarCross RefCross Ref
  16. V. S. Pai, P. Druschel, and W. Zwaenepoel. Flash: An efficient and portable web server. In Proc. USENIX Tech. Conf., pages 199--212. Usenix, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. G. Pettyjohn, J. Clements, J. Marshall, S. Krishnamurthi, and M. Felleisen. Continuations from generalized stack inspection. In ICFP '05, pages 216--227, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. C. Queinnec. Inverting back the inversion of control or, continuations versus page-centric programming. SIGPLAN Not., 38(2):57--64, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. J. Reppy. Cml: A higher concurrent language. In PLDI '91, pages 293--305, New York, NY, USA, 1991. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. R. von Behren, J. Condit, and E. Brewer. Why events are a bad idea (for high-concurrency servers). In HotOS IX, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. R. von Behren, J. Condit, F. Zhou, G. Necula, and E. Brewer. Capriccio: scalable threads for internet services. In SOSP '03, pages 268--281. ACM, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. M. Welsh, D. Culler, and E. Brewer. SEDA: An architecture for well-conditioned, scalable Internet services. In SOSP '01. ACM, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Tasks: language support for event-driven programming

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in
        • Published in

          cover image ACM Conferences
          PEPM '07: Proceedings of the 2007 ACM SIGPLAN symposium on Partial evaluation and semantics-based program manipulation
          January 2007
          180 pages
          ISBN:9781595936202
          DOI:10.1145/1244381

          Copyright © 2007 ACM

          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]

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 15 January 2007

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Qualifiers

          • Article

          Acceptance Rates

          Overall Acceptance Rate66of120submissions,55%

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader