Gabriel Kerneis — Continuation Passing C (CPC)

Home | Research | Software | Contact

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 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.

Reading

Gabriel Kerneis, Juliusz Chroboczek. CPC: programming with a massive number of lightweight threads. PLACES'11 (hal-00563369). 2011.

Gabriel Kerneis, Juliusz Chroboczek. Continuation-Passing C, compiling threads to events through continuations. Submitted for publication (inria-00537964). 2012.

Juliusz Chroboczek. Continuation Passing for C: A space-efficient implementation of concurrency. PPS technical report. 2005.

Gabriel Kerneis, Juliusz Chroboczek. Are events fast?. Technical report, Université Paris Diderot (hal-00434374). 2009.
Experimental setup: how to benchmark a web server.

Matthieu Boutier. Sauvegarde de variables locales en CPC. Undergraduate thesis. 2011.

Juliusz Chroboczek, Gabriel Kerneis. The CPC manual. Release 0.1. 2010.

Download

CPC 0.1.1 is available: cpc-0.1.1.tar.gz (PGP signature)

In order to download and build the latest version of the CPC translator:

  • git clone git://kerneis.info/cpc
  • cd cpc
  • ./configure
  • make
  • make testcpc

CIL patches

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:

  • git clone git://github.com/kerneis/cil

Back to my software page