Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Thread, Isolate and Process in Dart

Tags:

flutter

dart

What's the difference between Thread, Isolate and a Process in Dart?

As far as I know Dart is a single-threaded language, but it can spawn many isolates which don't share memories with each other and we can do the heavy lifting work on them and return the result without blocking the UI.

But what Process is for, is that a part of an Isolate? Can anyone describe above three in more detail.

And when we do asynchronous programming using Future and let's see we are doing heavy lifting in it, will that block the UI thread in case it is awaited using the await keyword.

like image 603
iDecode Avatar asked Jul 03 '26 18:07

iDecode


1 Answers

A Process is a native OS (Unix, Windows, MacOS) construct, which consists of one or more threads with their own address space and execution environment. In Dart, an application consists of one or more threads, one of which is the main UI thread, while the rest are typically called Isolates.

like image 133
Randal Schwartz Avatar answered Jul 05 '26 08:07

Randal Schwartz