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, 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:
While hacking on CPC, I needed to write some patches for CIL and ocamlutil. I am now the official maintainer of the CIL project, and my patches have therefore been accepted in the upstream repository. CIL has migrated to git! CIL mirror on Github: