Skip to content

Commit

Permalink
Add note regarding synchronous communication between too many isolates
Browse files Browse the repository at this point in the history
  • Loading branch information
aam committed Oct 30, 2024
1 parent 17ccab9 commit a654eca
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/content/language/isolates.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ but here are some more situations where they can be useful:
- Performing I/O, such as communicating with a database.
- Handling a large volume of network requests.

Also note a caveat due to a limit to the number of concurrently running isolates:

- The limit is not hardcoded to a particular number, it is calculated based on the Dart VM heap size available to the Dart application, can be considered to between 8 and 32 depending on the platform.
- This limit doesn't affect asynchronous communction between isolates via messages - you can have hundreds of isolates running and making progress. The isolates are scheduled on CPU in round-robin fashion and yield to each other isolate often.
- Attempts to do *synchronous* communication between isolates over the limit though will result in a deadlock.

[Flutter]: {{site.flutter-docs}}/perf/isolates

## Implementing a simple worker isolate
Expand Down

0 comments on commit a654eca

Please sign in to comment.