其他语言的Erlang式并发 [英] Erlang-style Concurrency for Other Languages
问题描述
其他编程语言提供了一个Erlang风格并发模型(进程,邮箱,模式匹配接收等)的库?
What libraries exist for other programming languages to provide an Erlang-style concurrency model (processes, mailboxes, pattern-matching receive, etc.)?
注意:
推荐答案
消息传递接口(消息传递接口) (MPI)( http://www-unix.mcs.anl.gov/mpi/ )是一个高度可扩展且强大的并行编程库,适用于C语言,但现在有多种语言可用 http://en.wikipedia.org/wiki/Message_Passing_Interface#Implementations 。虽然库没有引入新的语法,但它提供了一个通信协议来协调可并行化的例程之间的数据共享。
Message Passing Interface (MPI) (http://www-unix.mcs.anl.gov/mpi/) is a highly scalable and robust library for parallel programming, geared original towards C but now available in several flavors http://en.wikipedia.org/wiki/Message_Passing_Interface#Implementations. While the library doesn't introduce new syntax, it provides a communication protocol to orchestrate the sharing of data between routines which are parallelizable.
传统上,它用于大型集群
Traditionally, it is used in large cluster computing rather than on a single system for concurrency, although multi-core systems can certainly take advantage of this library.
并行编程问题的另一个有趣的解决方案是OpenMP,这是试图在各种平台上提供便携式扩展,以向编译器提供关于代码的哪些部分可容易并行化的提示。
Another interesting solution to the problem of parallel programming is OpenMP, which is an attempt to provide a portable extension on various platforms to provide hints to the compiler about what sections of code are easily parallelizable.
例如( http://en.wikipedia.org/wiki/OpenMP#Work-sharing_constructs ): p>
For example (http://en.wikipedia.org/wiki/OpenMP#Work-sharing_constructs):
#define N 100000
int main(int argc, char *argv[])
{
int i, a[N];
#pragma omp parallel for
for (i=0;i<N;i++)
a[i]= 2*i;
return 0;
}
当然,这两者都有优点和缺点,在学术界和其他重型科学计算应用中极为成功。 YMMV。
There are advantages and disadvantages to both, of course, but the former has proven to be extremely successful in academia and other heavy scientific computing applications. YMMV.
这篇关于其他语言的Erlang式并发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!