Sunday, 15 August 2010

Difference between DART Isolate and Thread (Java,C#) -



Difference between DART Isolate and Thread (Java,C#) -

for me dart isolate looks thread (java/c#) different terminology. in aspect isolate differs thread?

threads utilize shared memory, isolates don't.

for example, next pseudocode in java/c#

class="lang-java prettyprint-override">class myclass { static int count = 0; } // thread 1: myclass.count++; print(myclass.count); // 1; // thread 2: myclass.count++; print(myclass.count); // 2;

this runs risk of shared memory beingness modified simultaneously both threads.

whereas in dart,

class="lang-dart prettyprint-override">class myclass { static int count = 0; } // isolate 1: myclass.count++; print(myclass.count); // 1; // isolate 2: myclass.count++; print(myclass.count); // 1;

isolates isolated each other. way communicate between them pass messages. 1 isolate can hear callbacks other.

check out docs here including "isolate concepts" section.

dart

No comments:

Post a Comment