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.
- 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 ScholarDigital Library
- A. Appel. Compiling with continuations. Cambridge University Press, 1991. Google ScholarDigital Library
- Enterprise Java Beans, http://java.sun.com/products/ejb/.Google Scholar
- David Bond. Fizmez web server. http://sourceforge.net/projects/fizmezwebserver.Google Scholar
- R. Engelschall. Portable multithreading - the signal stack trick for user-space thread creation. In Proc. USENIX Tech. Conf., June 2000. Google ScholarDigital Library
- 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 Scholar
- S. Ganz, D. Friedman, and M. Wand. Trampolined style. In ICFP '99, pages 18--27, 1999. Google ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- M. Krohn, E. Kohler, F. Kaashoek, and D. Mazieres. The Tame event-driven framework. http://www.okws.org/doku.php?id=okws:tame.Google Scholar
- P. Li and S. Zdancewic. Advanced control flow in java card programming. In LCTES '04, pages 165--174. ACM Press, 2004. Google ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarCross Ref
- 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 ScholarDigital Library
- G. Pettyjohn, J. Clements, J. Marshall, S. Krishnamurthi, and M. Felleisen. Continuations from generalized stack inspection. In ICFP '05, pages 216--227, 2005. Google ScholarDigital Library
- C. Queinnec. Inverting back the inversion of control or, continuations versus page-centric programming. SIGPLAN Not., 38(2):57--64, 2003. Google ScholarDigital Library
- J. Reppy. Cml: A higher concurrent language. In PLDI '91, pages 293--305, New York, NY, USA, 1991. ACM Press. Google ScholarDigital Library
- R. von Behren, J. Condit, and E. Brewer. Why events are a bad idea (for high-concurrency servers). In HotOS IX, 2003. Google ScholarDigital Library
- 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 ScholarDigital Library
- M. Welsh, D. Culler, and E. Brewer. SEDA: An architecture for well-conditioned, scalable Internet services. In SOSP '01. ACM, 2001. Google ScholarDigital Library
Index Terms
- Tasks: language support for event-driven programming
Recommendations
Getting a grip on tasks that coordinate tasks
LDTA '11: Proceedings of the Eleventh Workshop on Language Descriptions, Tools and ApplicationsWorkflow management systems (WFMS) are software systems that coordinate the tasks human workers and computers have to perform to achieve a certain goal. The tasks to do and their interdependencies are described in a Workflow Description Language (WDL). ...
Comments