Continuation-passing for C: a space-efficient implementation of concurrency
Résumé
Threads are a convenient abstraction for programming concurrent systems. They are however expensive, which leads many programmers to use coarse-grained concurrency where a fine-grained structure would be preferable, or use more cumbersome implementation techniques. Cooperative threads can be easily implemented in a language that provides {\em first-class continuations}. Unfortunately, CPS conversion, the standard technique for adding continuations to a language, is not natural for typical imperative languages. This paper defines a notion of CPS conversion for the C programming language. Continuation Passing C (CPC) is a concurrent extension of C with very cheap threads. It is implemented as a series of source-to-source transformations, including CPS conversion, that convert a threaded program in direct style into a purely sequential C program. In this paper, we describe CPC and the transformations that are used in its implementation.
Domaines
Informatique
Origine : Fichiers produits par l'(les) auteur(s)
Loading...