Gabriel Kerneis (PPS, Université Paris Diderot), From threads to events through classical program transformations



Threads and events are two common techniques to implement concurrent programs. Events are often deemed harder to write and understand than threads, because their control flow is scattered across long chains of callbacks. But the programmer cannot always afford using threads, due to resource constraints (eg. embedded systems) or language limitation (eg. javascript). In such cases, it might be desirable to translate threads into events automatically.

We present several styles of event-driven programs and study how to generate them from a threaded description, in the particular case of C programs. Our translation steps are made of classical and proven transformation techniques, most notably lambda-lifting and conversion into continuation-passing style.

These techniques have been used to implement the <a href="">CPC translator</a>.