Fine-grain multithreading with minimal compiler support—a cost effective approach to implementing efficient multithreading languages

Fine-grain multithreading with minimal compiler support—a cost effective approach to implementing efficient multithreading languages
复制标题

具有最少编译器支持的细粒度多线程——一种实现高效多线程语言的经济有效的方法

DOI:
--
复制
发表时间:
1997
期刊:
ACM-SIGPLAN Symposium on Programming Language Design and Implementation
影响因子:
--
通讯作者:
A. Yonezawa
A. Yonezawa
中科院分区:
--
文献类型:
--
作者:
K. Taura;A. Yonezawa

文献摘要

被引文献

相似文献

很难将多线程语言(支持细粒度动态线程创建的语言)的执行模型映射到C的单栈执行模型上。因此,以前的高效多线程工作使用了精心设计的帧格式和分配策略,并为它们定制了编译器。本文提出了一种替代的成本效益的多线程语言的实现策略,可以最大限度地利用当前的顺序C编译器。我们确定了一组原语,从而可以实现高效的动态线程创建和切换,并澄清实现问题和解决方案的堆栈框架布局和当前C编译器的调用约定下工作。这些原语被实现为一个C库,并命名为StackThreads。在StackThreads中,线程创建仅通过C过程调用完成,从而最大化线程创建性能。当过程挂起执行时,过程的上下文(大致是过程的堆栈帧)被保存到堆中,稍后再恢复。使用StackThreads,编译器编写者可以直接将源语言的顺序结构转换为相应的C语句或表达式,同时使用StackThreads原语作为在C过程之间切换执行的黑盒机制。
It is difficult to map the execution model of multithreading languages (languages which support fine-grain dynamic thread creation) onto the single stack execution model of C. Consequently, previous work on efficient multithreading uses elaborate frame formats and allocation strategy, with compilers customized for them. This paper presents an alternative cost-effective implementation strategy for multithreading languages which can maximally exploit current sequential C compilers. We identify a set of primitives whereby efficient dynamic thread creation and switch can be achieved and clarify implementation issues and solutions which work under the stack frame layout and calling conventions of current C compilers. The primitives are implemented as a C library and named StackThreads. In StackThreads, a thread creation is done just by a C procedure call, maximizing thread creation performance. When a procedure suspends an execution, the context of the procedure, which is roughly a stack frame of the procedure, is saved into heap and resumed later. With StackThreads, the compiler writer can straightforwardly translate sequential constructs of the source language into corresponding C statements or expressions, while using StackThreads primitives as a blackbox mechanism which switches execution between C procedures.