javascript - Is Dart truly parallel or is it concurrent - Stack Overflow

I have just found about Dart from Google and wanted to know if true parallelism can be obtained using D

I have just found about Dart from Google and wanted to know if true parallelism can be obtained using Dart. From what I know my answer would be no because finally it runs just as Javascript(I cannot ment about how it run on the Dart VM) but then why the design decision of introducing async and await keywords? Will this bee something like Erlang?

I have just found about Dart from Google and wanted to know if true parallelism can be obtained using Dart. From what I know my answer would be no because finally it runs just as Javascript(I cannot ment about how it run on the Dart VM) but then why the design decision of introducing async and await keywords? Will this bee something like Erlang?

Share Improve this question asked Jun 7, 2017 at 10:33 vaibhav.pndvaibhav.pnd 1952 silver badges9 bronze badges 5
  • 1 What exactly does "true parallelism" mean to you? Multiple electrons moving at the same time in the CPU? – Bergi Commented Jun 7, 2017 at 10:38
  • No, I mean that multiple threads executing to run the code. Concurrency does not mean the same. – vaibhav.pnd Commented Jun 7, 2017 at 10:41
  • 1 For what it's worth - plain JavaScript has async and await keywords now too. In both languages, it's just syntax sugar over other async primitives (Futures in Dart, Promises in JS). – Joe Clay Commented Jun 7, 2017 at 10:46
  • 1 "why the design decision of introducing async and await keywords?" - I don't understand, you could need those both for multi-threaded and single-threaded concurrency? – Bergi Commented Jun 7, 2017 at 10:46
  • async makes it easy to write, debug and understand concurrent code. Most of the popular concurrent and parallel platforms already use async and await. I think maybe with the introduction of Atomics and ShareMemory in ECMAScript 2018 sometime later this should bee parallel. – vaibhav.pnd Commented Jun 8, 2017 at 5:16
Add a ment  | 

1 Answer 1

Reset to default 9

A Dart application can consist of one or more isolates. Isolates run as threads (other implementations are possible) and run parallel (also on different CPUs). Communication between isolates works with message passing.

Code within a single isolate is single-threaded and there is no parallelism at all. The execution is event-driven. See also https://webdev.dartlang/articles/performance/event-loop

async/await is just syntactic sugar to make async code look more like sync code, but it doesn't make code running sync.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744219732a4563723.html

相关推荐

  • javascript - Is Dart truly parallel or is it concurrent - Stack Overflow

    I have just found about Dart from Google and wanted to know if true parallelism can be obtained using D

    8天前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信