Lambda lifting: transforming programs to recursive equations
Proc. of a conference on Functional programming languages and computer architecture
Obtaining coroutines with continuations
Computer Languages
Flow diagrams, turing machines and languages with only two formation rules
Communications of the ACM
SEDA: an architecture for well-conditioned, scalable internet services
SOSP '01 Proceedings of the eighteenth ACM symposium on Operating systems principles
Concurrent ML: Design, Application and Semantics
Functional Programming, Concurrency, Simulation and Automated Reasoning: International Lecture Series 1991-1992, McMaster University, Hamilton, Ontario, Canada
Cooperative Task Management Without Manual Stack Management
ATEC '02 Proceedings of the General Track of the annual conference on USENIX Annual Technical Conference
CIL: Intermediate Language and Tools for Analysis and Transformation of C Programs
CC '02 Proceedings of the 11th International Conference on Compiler Construction
A Toolkit for User-Level File Systems
Proceedings of the General Track: 2002 USENIX Annual Technical Conference
PLDI '03 Proceedings of the ACM SIGPLAN 2003 conference on Programming language design and implementation
Lambda: The Ultimate Imperative
Lambda: The Ultimate Imperative
A poor man's concurrency monad
Journal of Functional Programming
Protothreads: simplifying event-driven programming of memory-constrained embedded systems
Proceedings of the 4th international conference on Embedded networked sensor systems
Tasks: language support for event-driven programming
Proceedings of the 2007 ACM SIGPLAN symposium on Partial evaluation and semantics-based program manipulation
QEMU, a fast and portable dynamic translator
ATEC '05 Proceedings of the annual conference on USENIX Annual Technical Conference
Proceedings of the 2007 ACM SIGPLAN conference on Programming language design and implementation
ATC'07 2007 USENIX Annual Technical Conference on Proceedings of the USENIX Annual Technical Conference
MapJAX: data structure abstractions for asynchronous web applications
ATC'07 2007 USENIX Annual Technical Conference on Proceedings of the USENIX Annual Technical Conference
Gradual typing of erlang programs: a wrangler experience
Proceedings of the 7th ACM SIGPLAN workshop on ERLANG
Lwt: a cooperative thread library
Proceedings of the 2008 ACM SIGPLAN workshop on ML
Kilim: Isolation-Typed Actors for Java
ECOOP '08 Proceedings of the 22nd European conference on Object-Oriented Programming
ACM Transactions on Programming Languages and Systems (TOPLAS)
Scala Actors: Unifying thread-based and event-based programming
Theoretical Computer Science
Proceedings of the 14th ACM SIGPLAN international conference on Functional programming
The F# asynchronous programming model
PADL'11 Proceedings of the 13th international conference on Practical aspects of declarative languages
Towards deriving type systems and implementations for coroutines
APLAS'10 Proceedings of the 8th Asian conference on Programming languages and systems
AC: composable asynchronous IO for native languages
Proceedings of the 2011 ACM international conference on Object oriented programming systems languages and applications
Delimited control in OCaml, abstractly and concretely
Theoretical Computer Science
Continuation-Passing C, compiling threads to events through continuations
Higher-Order and Symbolic Computation
Frama-C: a software analysis perspective
SEFM'12 Proceedings of the 10th international conference on Software Engineering and Formal Methods
Hi-index | 0.00 |
Coroutines and events are two common abstractions for writing concurrent programs. Because coroutines are often more convenient, but events more portable and efficient, it is natural to want to translate the former into the latter. CPC is such a source-to-source translator for C programs, based on a partial conversion into continuation-passing style (CPS conversion) of functions annotated as cooperative. In this article, we study the application of the CPC translator to QEMU, an open-source machine emulator which also uses annotated coroutine functions for concurrency. We first propose a new type of annotations to identify functions which never cooperate, and we introduce CoroCheck, a tool for the static analysis and inference of cooperation annotations. Then, we improve the CPC translator, defining CPS conversion as a calling convention for the C language, with support for indirect calls to CPS-converted function through function pointers. Finally, we apply CoroCheck and CPC to QEMU (750 000 lines of C code), fixing hundreds of missing annotations and comparing performance of the translated code with existing implementations of coroutines in QEMU. Our work shows the importance of static annotation checking to prevent actual concurrency bugs, and demonstrates that CPS conversion is a flexible, portable, and efficient compilation technique, even for very large programs written in an imperative language.