Skip to content

Prepare, dispatch, interrupt, release

A cell monitor drives its runtime provider with one language-neutral vocabulary, RuntimeProviderProtocolV1. Four of its verbs carry execution: prepare readies the provider for a sealed environment, dispatch runs one authorised attempt, interrupt asks about stopping an attempt, and release drops one provider-local object. This page covers what each verb sends and returns, how the two message codecs divide the traffic, and how the provider keeps track of attempts.

The session

flowchart LR
  subgraph MONBOX["CELL MONITOR, TRUSTED"]
    direction TB
    CL["Protocol client<br/>validates every report"]
  end
  subgraph PROVBOX["RUNTIME PROVIDER, UNTRUSTED"]
    direction TB
    SRV["Protocol server"]
    RUN["One interpreter,<br/>one event loop"]
    ATT[("Completed attempt ids<br/>bounded")]
    SRV --> RUN
    SRV --> ATT
  end
  CL -->|"control: prepare, interrupt, release<br/>closed JSON control codec"| SRV
  CL -->|"dispatch<br/>typed binary frame codec"| SRV
  SRV -.->|"reports and outcomes"| CL

Control messages use the closed JSON control codec. Dispatch and outcome messages use the typed binary frame codec, which carries values as the declared interface types. Both travel over the cell control channel. See The provider protocol.

The four verbs

Verb The monitor sends The provider returns
prepare The sealed environment, the compiled interface and the declared imports A preparation report naming the exports it prepared
dispatch One already-authorised typed attempt A typed outcome: a value, a declared error, a guest fault, or a resource or stream proposal
interrupt The attempt id in question Its factual observation of that attempt
release One provider-local resource id A release receipt for that id

health, quiesce and terminate complete the vocabulary. See Health, quiesce, terminate.

Every provider implements these verbs with the shared protocol's meanings, fault terminality and receipt rules. The CPython provider and any other provider differ in how they execute, and are driven identically.

Prepare

prepare admits the sealed environment, the compiled interface and the declared imports. The monitor checks the returned report against its own request: a report may name only exports the request declared. A successful report is one input to the ProviderReady receipt, which the monitor and the nucleus produce. See Process lifecycle.

Dispatch

A dispatch frame carries execution the nucleus already authorised. It names an export ordinal and a method ordinal, and carries typed arguments. The server serialises guest execution around its one interpreter and event loop. See Call and resource invocation.

The provider remembers a bounded set of completed attempt ids. A dispatch that repeats a remembered attempt id is refused, so one attempt executes once.

Interrupt

interrupt returns what the provider observed about one attempt, in one of three states:

  • in flight: the attempt is executing;
  • already complete: the attempt finished and its outcome was sent;
  • unseen: the provider has no record of the attempt.

The interruption modes a session may use are the intersection of the grant's allowed modes, the certified modes in the sealed compatibility evidence, the containment profile's allowed modes and the modes the provider advertises. TerminateProcessOnly is available to every session, and is performed by the monitor through the process cell. See Cooperative cancellation and quiesce.

Release

release drops one object from the provider's resource table and is idempotent. A release receipt answers the resource id that was named. The monitor sends release only to a provider that negotiated a resource table. See Provider resource table.