Skip to main content

Pause ’n’ Play: Formalizing Asynchronous C\(^\sharp\)

  • Conference paper

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 7313))

Abstract

Writing applications that connect to external services and yet remain responsive and resource conscious is a difficult task. With the rise of web programming this has become a common problem. The solution lies in using asynchronous operations that separate issuing a request from waiting for its completion. However, doing so in common object-oriented languages is difficult and error prone. Asynchronous operations rely on callbacks, forcing the programmer to cede control. This inversion of control-flow impedes the use of structured control constructs, the staple of sequential code. In this paper, we describe the language support for asynchronous programming in the upcoming version of C\(^\sharp\). The feature enables asynchronous programming using structured control constructs. Our main contribution is a precise mathematical description that is abstract (avoiding descriptions of compiler-generated state machines) and yet sufficiently concrete to allow important implementation properties to be identified and proved correct.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Adya, A., Howell, J., Theimer, M., Bolosky, W.J., Douceur, J.R.: Cooperative task management without manual stack management. In: Proceedings of USENIX (2002)

    Google Scholar 

  2. Bierman, G., Meijer, E., Torgersen, M.: Lost in translation: Formalizing proposed extensions to C\(^{\sharp}\). In: Proceedings of OOPSLA (2007)

    Google Scholar 

  3. Bierman, G., Meijer, E., Torgersen, M.: Adding Dynamic Types to C\(^\sharp\). In: D’Hondt, T. (ed.) ECOOP 2010. LNCS, vol. 6183, pp. 76–100. Springer, Heidelberg (2010)

    Chapter  Google Scholar 

  4. Bierman, G., Parkinson, M., Pitts, A.: MJ: An imperative core calculus for Java and Java with effects. Technical Report 563, University of Cambridge Computer Laboratory (2003)

    Google Scholar 

  5. Bruggeman, C., Waddell, O., Dybvig, R.K.: Representing control in the presence of one-shot continuations. In: Proceedings of PLDI (1996)

    Google Scholar 

  6. Duff, T.: Re: Explanation, please! (August 1988), USENET Article

    Google Scholar 

  7. Dunkels, A., Schmidt, O., Voigt, T., Ali, M.: Protothreads: Simplifying Event-Driven programming of Memory-Constrained embedded systems. In: Proceedings of SenSys (2006)

    Google Scholar 

  8. Fischer, J., Majumdar, R., Millstein, T.: Tasks: language support for event-driven programming. In: Proceedings of PEPM (2007)

    Google Scholar 

  9. Flanagan, C., Sabry, A., Duba, B., Felleisen, M.: The essence of compiling with continuations. In: Proceedings of PLDI (1993)

    Google Scholar 

  10. Flatt, M., Krishnamurthi, S., Felleisen, M.: A programmer’s reduction semantics for classes and mixins. Technical Report TR-97-293, Rice University (1997)

    Google Scholar 

  11. Haller, P., Odersky, M.: Scala actors: Unifying thread-based and event-based programming. Theoretical Computer Science 410(2-3), 202–220 (2009)

    Article  MathSciNet  MATH  Google Scholar 

  12. Hejlsberg, A., Torgersen, M., Wiltamuth, S., Golde, P.: The C\(^\sharp\) Programming Language, 4th edn. Addison-Wesley (2011)

    Google Scholar 

  13. Igarashi, A., Pierce, B., Wadler, P.: Featherweight Java: A minimal core calculus for Java and GJ. ACM TOPLAS 23(3), 396–450 (2001)

    Article  Google Scholar 

  14. Lauer, H.C., Needham, R.M.: On the duality of operating system structures. Operating Systems Review 13(2), 3–19 (1979)

    Article  Google Scholar 

  15. Li, P., Zdancewic, S.: Combining events and threads for scalable network services. In: Proceedings of PLDI (2007)

    Google Scholar 

  16. Microsoft Corporation. C# language specification for asynchronous functions (2011), http://msdn.microsoft.com/en-us/vstudio/async

  17. Ousterhout, J.K.: Why threads are a bad idea (for most purposes). In: USENIX Winter Technical Conference, Invited Talk (June 1996)

    Google Scholar 

  18. Pierce, B., Turner, D.: Local type inference. In: Proceedings of POPL (1998)

    Google Scholar 

  19. Rompf, T., Maier, I., Odersky, M.: Implementing first-class polymorphic delimited continuations by a type-directed selective CPS-transform. In: Proceedings of ICFP (2009)

    Google Scholar 

  20. Syme, D., Petricek, T., Lomov, D.: The F# Asynchronous Programming Model. In: Rocha, R., Launchbury, J. (eds.) PADL 2011. LNCS, vol. 6539, pp. 175–189. Springer, Heidelberg (2011)

    Chapter  Google Scholar 

  21. Tatham, S.: Coroutines in C (2000), http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html

  22. von Behren, R., Condit, J., Brewer, E.: Why events are a bad idea (for high-concurrency servers). In: Proceedings of HotOS (2003)

    Google Scholar 

  23. von Behren, R., Condit, J., Zhou, F., Necula, G.C., Brewer, E.: Capriccio: scalable threads for internet services. In: Proceedings of SOSP (2003)

    Google Scholar 

  24. Wand, M.: Continuation-based multiprocessing. In: Proceedings of LISP and Functional Programming (1980)

    Google Scholar 

  25. Welsh, M., Culler, D., Brewer, E.: SEDA: an architecture for well-conditioned, scalable internet services. In: Proceedings of SOSP (2001)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2012 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Bierman, G., Russo, C., Mainland, G., Meijer, E., Torgersen, M. (2012). Pause ’n’ Play: Formalizing Asynchronous C\(^\sharp\) . In: Noble, J. (eds) ECOOP 2012 – Object-Oriented Programming. ECOOP 2012. Lecture Notes in Computer Science, vol 7313. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-31057-7_12

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-31057-7_12

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-31056-0

  • Online ISBN: 978-3-642-31057-7

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics