Skip to content

Cooperative cancellation and quiesce

A runtime provider participates in shutdown through two separate protocol operations. Interruption targets one concrete attempt. Quiesce stops the session from taking new work while its current work is reconciled. Both are bounded by monitor-owned lifecycle rules, and both return observations for the monitor to admit.

Attempt interruption

flowchart TB
  subgraph NUC["NUCLEUS"]
    direction TB
    CLS{{"Classifies the terminal<br/>or ambiguous outcome"}}
  end
  subgraph CELL["CELL"]
    direction TB
    MON{{"Cell monitor<br/>admits the receipt against<br/>the in-flight attempt"}}
    PROV["Runtime provider<br/>cancellation token per attempt"]
  end
  MON -->|"1. interrupt: attempt id,<br/>effective mode"| PROV
  PROV -.->|"2. delivered, already complete,<br/>or unknown attempt"| MON
  MON -->|"3. interruption and<br/>completion observations"| CLS

Runtime provider reports what it saw for one attempt, and Cell monitor binds that report to the attempt it dispatched. The outcome is decided by the nucleus in Classifies the terminal or ambiguous outcome.

The provider receives an attempt id and one negotiated interruption mode. A cooperative implementation signals the cancellation token associated with that attempt. It then reports one of three observations:

  • delivery reached the attempt;
  • the attempt had already completed;
  • the provider had no matching attempt.

These observations describe provider-local state. The monitor binds them to the admitted attempt, and the nucleus decides the task outcome. A delivery receipt proves that the interruption reached the provider; guest stop and effect outcome require their own observations.

Certified mechanisms

Some provider implementations can expose a provider-specific interruption mechanism. The mechanism becomes usable only when the sealed runtime authority names the exact certification record, mechanism id and evidence digest, the containment profile permits its class, and provider negotiation confirms support. Cooperative interruption remains preferred whenever both are usable.

The certification applies to one named mechanism. Arbitrary thread injection, signals and asynchronous exceptions remain outside that runtime authority.

Quiesce and terminate

Quiesce applies to the provider session. The provider reports the in-flight attempts it has quiesced, allowing the monitor to reconcile them before shutdown. Terminate asks the provider to release its runtime state and return a termination receipt. The process-cell owner retains the final enforcement boundary: after the grace interval it can terminate the provider process and invalidate the cell epoch.

Operation Scope Successful observation
Interrupt One attempt Delivered, already complete, or unknown attempt
Quiesce Provider session Bounded set of in-flight attempts
Terminate Provider session Termination receipt and released provider state
Process termination Provider process and owner epoch Process-exit receipt and epoch invalidation

Provider code should reach cancellation points around awaits, iteration and other bounded work. CPU-bound native code can delay cooperative delivery; the containment grace interval keeps that delay bounded at the system boundary. See Await and iteration, Health, quiesce, terminate and Deadline and cancellation forwarding.