Isolates
An isolate is a running program's own world: its memory, the static data it runs against, and the work running in it. Nothing outside an isolate can reach into it, and in V0 every program runs as exactly one.
That's why a program's build file starts with IsolateAssemblyBuild: what it builds is an isolate. A library builds
code for isolates to use, and doesn't run by itself. Assemblies has the
details.
What an isolate owns
- Its heap. Every instance the program makes lives on its isolate's heap, and only that isolate's work allocates from it. Memory management says how it's reclaimed.
- Its static data. Top-level values and a program's links to its libraries belong to the isolate, so two isolates never share one.
- Its resources.
Resources.datagives the isolate its own copy of a file the program ships.
When something goes wrong
A fault ends the run. Reading past the end of an array, dividing an integer by zero, overflowing the stack and running out of heap are all faults, and each one ends the isolate at once, wherever in the program it happened.
The board keeps running. A fault ends your program, not the system under it, so the board reports which fault it was, and you can run again without restarting it.
More than one isolate
A V0 program is one isolate, and can't start another yet. When it can, isolates stay apart: a call from one to another copies what it carries, and no reference to an instance ever crosses. Structs are the form data takes on the way.