arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 1210.4263cs.PL
收藏

使用样式生成事件

Generating events with style

Matthieu Boutier, Gabriel Kerneis

摘要:

线程和事件是编写并发程序的两种常见抽象。由于线程通常更方便,而事件更高效,因此很自然地希望将前者转换为后者。然而,尽管有许多不同的事件驱动风格,现有的翻译器往往适用临时规则,不反映这种多样性。我们分析各种控制流和数据流编码在现实世界中的事件驱动的代码,我们观察到,它是可以自动生成这些风格的线程代码,通过应用某些精心选择的经典程序转换。特别是,我们实现了两个这些转换,lambda提升和环境,在CPC,C语言编写并发系统的扩展。最后,我们发现,虽然很少在现实世界的程序中使用,因为它是繁琐的手动执行,lambda提升产生更好的性能比我们的大多数基准测试的环境。

英文摘要:

Threads and events are two common abstractions for writing concurrent programs. Because threads are often more convenient, but events more efficient, it is natural to want to translate the former into the latter. However, whereas there are many different event-driven styles, existing translators often apply ad-hoc rules which do not reflect this diversity. We analyse various control-flow and data-flow encodings in real-world event-driven code, and we observe that it is possible to generate any of these styles automatically from threaded code, by applying certain carefully chosen classical program transformations. In particular, we implement two of these transformations, lambda lifting and environments, in CPC, an extension of the C language for writing concurrent systems. Finally, we find out that, although rarely used in real-world programs because it is tedious to perform manually, lambda lifting yields better performance than environments in most of our benchmarks.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑