Will Dart execute isolates in parallel in a multi-core environment?

后端 未结 3 463
终归单人心
终归单人心 2021-02-01 06:18

Question

Will isolates in Dart run in parallel utilizing all available cores on a multiple core environment, or will it multiplex on a single core?

Background

3条回答
  •  醉梦人生
    2021-02-01 06:57

    I looked it up. The isolates seem to be actual threads.

    The only mechanism available to communicate between isolates is to pass messages.

    Very good, except

    Each isolate has its own heap, which means that all values in memory, including globals, are available only to that isolate.

    Not at all good, because of the messages:

    it is also possible to send object instances (which would be copied in the process

    Very bad.

    This scheme would seem to make it impossible to communicate large amounts of data from one isolate to another without copying it, so eliminating efficient interisolate communication.

    I would not use it because of this restriction that disallows the passing of large objects/buffers by address, as one would normally do with conventional threads.

    It looked interesting at first, because I use almost exclusively message-passing designs, but they knackered the inter-thread comms by insisting on only private heaps.

提交回复
热议问题