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.
Access provided by Autonomous University of Puebla. Download to read the full chapter text
Chapter PDF
Similar content being viewed by others
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
References
Adya, A., Howell, J., Theimer, M., Bolosky, W.J., Douceur, J.R.: Cooperative task management without manual stack management. In: Proceedings of USENIX (2002)
Bierman, G., Meijer, E., Torgersen, M.: Lost in translation: Formalizing proposed extensions to C\(^{\sharp}\). In: Proceedings of OOPSLA (2007)
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)
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)
Bruggeman, C., Waddell, O., Dybvig, R.K.: Representing control in the presence of one-shot continuations. In: Proceedings of PLDI (1996)
Duff, T.: Re: Explanation, please! (August 1988), USENET Article
Dunkels, A., Schmidt, O., Voigt, T., Ali, M.: Protothreads: Simplifying Event-Driven programming of Memory-Constrained embedded systems. In: Proceedings of SenSys (2006)
Fischer, J., Majumdar, R., Millstein, T.: Tasks: language support for event-driven programming. In: Proceedings of PEPM (2007)
Flanagan, C., Sabry, A., Duba, B., Felleisen, M.: The essence of compiling with continuations. In: Proceedings of PLDI (1993)
Flatt, M., Krishnamurthi, S., Felleisen, M.: A programmer’s reduction semantics for classes and mixins. Technical Report TR-97-293, Rice University (1997)
Haller, P., Odersky, M.: Scala actors: Unifying thread-based and event-based programming. Theoretical Computer Science 410(2-3), 202–220 (2009)
Hejlsberg, A., Torgersen, M., Wiltamuth, S., Golde, P.: The C\(^\sharp\) Programming Language, 4th edn. Addison-Wesley (2011)
Igarashi, A., Pierce, B., Wadler, P.: Featherweight Java: A minimal core calculus for Java and GJ. ACM TOPLAS 23(3), 396–450 (2001)
Lauer, H.C., Needham, R.M.: On the duality of operating system structures. Operating Systems Review 13(2), 3–19 (1979)
Li, P., Zdancewic, S.: Combining events and threads for scalable network services. In: Proceedings of PLDI (2007)
Microsoft Corporation. C# language specification for asynchronous functions (2011), http://msdn.microsoft.com/en-us/vstudio/async
Ousterhout, J.K.: Why threads are a bad idea (for most purposes). In: USENIX Winter Technical Conference, Invited Talk (June 1996)
Pierce, B., Turner, D.: Local type inference. In: Proceedings of POPL (1998)
Rompf, T., Maier, I., Odersky, M.: Implementing first-class polymorphic delimited continuations by a type-directed selective CPS-transform. In: Proceedings of ICFP (2009)
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)
Tatham, S.: Coroutines in C (2000), http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html
von Behren, R., Condit, J., Brewer, E.: Why events are a bad idea (for high-concurrency servers). In: Proceedings of HotOS (2003)
von Behren, R., Condit, J., Zhou, F., Necula, G.C., Brewer, E.: Capriccio: scalable threads for internet services. In: Proceedings of SOSP (2003)
Wand, M.: Continuation-based multiprocessing. In: Proceedings of LISP and Functional Programming (1980)
Welsh, M., Culler, D., Brewer, E.: SEDA: an architecture for well-conditioned, scalable internet services. In: Proceedings of SOSP (2001)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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)