简体   繁体   English

是否有一种编程语言,其中每个功能实际上都是作为单独的参与者运行的?

[英]Is there a programming language where every function is essentially run as a separate actor?

Is there a programming language where you don't have to define actors yourself - every function is just ran as a separate actor (which can mean a separate thread if there are free cores available) by default? 是否有一种编程语言,您不必自己定义参与者-默认情况下,每个函数都作为单独的参与者运行(如果有可用的内核,则意味着一个单独的线程)?

For example it means that if I write something as simple as 例如,这意味着如果我写的东西像

v = fA(x) + fB(y)

then fA and fB could be calculated simultaneously before the sum of their results was assigned to v. 然后在将其结果的总和分配给v之前,可以同时计算fA和fB。

I don't think there is anything this extreme, since the context switching and comunication overhead would be too big. 我认为没有什么极端的情况,因为上下文切换和通信开销会太大。

The closest I can think of to what you are asking is data-parallel programing, where the program is mostly written in the same style as a sequential version but parts of it are ran in parallel where possible. 我能想到的最接近您所要求的是数据并行编程,该程序大多数以与顺序版本相同的样式编写,但在可能的情况下部分并行运行。

Examples are loop vectorization in Fortran and "par" magic in Haskell. 例如,Fortran中的循环矢量化和Haskell中的“ par”魔术。

Haskell's par combinator lets you evaluate expressions concurrently (which can mean in separate threads if there are free cores available). Haskell的par组合器可让您同时评估表达式(如果有可用的可用内核,则意味着在单独的线程中)。 All you have to do is: 您要做的就是:

x `par` y

Which will evaluate x and y concurrently, and return the value of y . 它将同时评估xy ,并返回y的值。 Note that x and y can be programs of arbitrary complexity. 注意, xy可以是任意复杂度的程序。

Joule is a pure asynchronous message passing language: Joule是一种纯异步消息传递语言:

http://en.wikipedia.org/wiki/Joule_%28programming_language%29 http://en.wikipedia.org/wiki/Joule_%28programming_language%29

http://www.erights.org/history/joule/MANUAL.BK5.pdf http://www.erights.org/history/joule/MANUAL.BK5.pdf

ActorScript is a pure Actor message-passing language, but appears to only exist as a specification: ActorScript是一种纯Actor消息传递语言,但似乎仅作为一种规范存在:

http://arxiv.org/abs/1008.2748 http://arxiv.org/abs/1008.2748

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM