Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

demote usage of "vat" in favor of "worker" #1263

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions main/guides/js-programming/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,23 @@ the sections below.
</ClientOnly>
:::

## Vats: the Unit of Synchrony
## Workers: the Unit of Synchrony

The Agoric framework uses the same [event loop concurrency model](https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop) as web browsers and Node.js.
Each event loop has a message queue, a call stack of frames, and a heap of objects:

![heap, stack, and queue](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Event_Loop/the_javascript_runtime_environment_example.svg)

We refer to this combination of an event loop with a message queue, a stack, and a heap as a _vat_.
::: tip Historical Note
The term "worker" in Agoric replaces the historical term "vat", which was inspired by the philosophical thought experiment "Brain in a Vat" - where a brain is sustained in isolation and connected to simulated inputs, similar to how our workers maintain strict isolation boundaries.
:::

We refer to this combination of an event loop with a message queue, a stack, and a heap as a _worker_.

Vats are the unit of synchrony. We can only use ordinary synchronous
function calls within the same vat. But we can use asynchronous function calls
(with [eventual send](./eventual-send)) either within the same vat or between vats.
Vats may be on remote machines, including massively replicated machines such as blockchains.
Workers are the unit of synchrony. We can only use ordinary synchronous
function calls within the same worker. But we can use asynchronous function calls
(with [eventual send](./eventual-send)) either within the same worker or between workers.
Workers may be on remote machines, including massively replicated machines such as blockchains.

## Parts of the Framework

Expand Down
14 changes: 7 additions & 7 deletions main/guides/platform/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ it's very important to ensure that one user cannot prevent another
user's code from executing and that the way in which code is
interleaved doesn't open up hazards such as reentrancy. SwingSet
solves that problem by dividing up the execution environment into
_vats_. A [vat](../js-programming/#vats-the-unit-of-synchrony) is a _unit
of synchrony_. This means that within a JavaScript vat, objects and
_workers_. A [worker](../js-programming/#workers-the-unit-of-synchrony) is a _unit
of synchrony_. This means that within a JavaScript worker, objects and
functions can communicate with one another synchronously. Between
vats, objects and functions communicate asynchronously, by design.
workers, objects and functions communicate asynchronously, by design.

A physical machine can run one or several vats. A blockchain can run
one or several communicating vats.
A physical machine can run one or several workers. A blockchain can run
one or several communicating workers.

The internal state of a vat can be stored in a persistent memory so
that the vat can be turned off and later turned back on (on the same
The internal state of a worker can be stored in a persistent memory so
that the worker can be turned off and later turned back on (on the same
or a different physical machine) by loading the stored state.

A SwingSet instance also handles communication between the vats it
Expand Down
Loading