CPC is a programming language for writing concurrent systems, designed and developped by Juliusz Chroboczek and Gabriel Kerneis.
The CPC programmer manipulates very lightweight threads, choosing whether they should be cooperatively or preemptively scheduled at any given point; the CPC program is then processed by the CPC translator, which produces highly efficient event-loop code. This approach gives the best of both worlds: the relative convenience of programming with threads, and the low memory usage of event-loop code.
The semantics of CPC is defined as a source-to-source translation from CPC into plain C using a technique known as conversion into Continuation Passing Style.
The current implementation of CPC has been used to write Hekate, a BitTorrent seeder designed to handle millions of simultaneous torrents and tens of thousands of simultaneously connected peers.
Gabriel Kerneis, Charlie Shepherd, Stefan Hajnoczi.
Analysis and CPS Conversion for Safe, Portable, and Efficient
PEPM'14, San Diego, CA, USA, January 20-21, 2014.
Also available in html and epub format.
Gabriel Kerneis. Continuation-Passing C: Program Transformation for Compiling Concurrency in an Imperative Language. PhD thesis. Laboratoire PPS, Université Paris Diderot (2012).
Gabriel Kerneis, Juliusz Chroboczek. Continuation-Passing C, compiling threads to events through continuations. Higher-Order and Symbolic Computation 24(3): 239-279 (2011). doi:10.1007/s10990-012-9084-5.
Gabriel Kerneis, Juliusz Chroboczek. CPC: programming with a massive number of lightweight threads. PLACES'11 (2011). hal-00563369.
Juliusz Chroboczek. Continuation Passing for C: A space-efficient implementation of concurrency. PPS technical report (2005).
Juliusz Chroboczek, Gabriel Kerneis. The CPC manual. Release 0.1 (2010).
In order to download and build the latest version of the CPC translator:
Please report bugs on the CPC bug tracker on Github.