Skip to content

Cell shared-memory channel

The cell control channel copies every call through a socket. For calls between process cells that happen thousands of times a second, the kernel offers a faster transport over shared memory: calls and completions travel through rings, and bulk data travels as sealed memory attachments. It implements the same channel interface as the cell control channel and produces the same outcomes, so either transport presents one observable channel behaviour to its caller. This page covers what the shared-memory channel consists of, how bulk data moves, and the conditions it operates under.

The fast path

flowchart TB
  NUC{{"Nucleus<br/>mints the channel after grant admission"}}
  subgraph CALLER["CALLER CELL"]
    direction TB
    CM["Caller monitor<br/>validates, spends credit"]
  end
  subgraph SHM["SHARED MEMORY"]
    direction TB
    RING[("Call and completion ring")]
    ATT[("Sealed attachments<br/>memfd, offset, length, rights, generation")]
  end
  subgraph OWNER["OWNER CELL"]
    direction TB
    OM["Owner monitor<br/>validates every field"]
  end
  NUC -->|"ChannelGrant"| CM
  NUC -->|"ChannelGrant"| OM
  CM -->|"compact call header"| RING
  RING --> OM
  OM -->|"completion"| RING
  CM --> ATT
  ATT --> OM

The nucleus mints a shared-memory channel after grant admission, the same way it installs any channel, and both monitors hold the same ChannelGrant. The monitors are the only writers of the ring's control memory. Block code writes only into buffer regions it holds a write right for, in the current buffer generation. See Channel authority.

Mapping lifecycle

The nucleus host creates two fixed-size backing objects for one channel epoch: one for calls and one for completions. On Linux they are anonymous memfd objects sealed against growth and shrinkage. The ring capacity is the smallest power of two that can hold the grant's call-credit limit, within the declared transport ceiling. Call credit remains equal to the nucleus grant regardless of extra physical slots.

The authenticated control channel tells each monitor which endpoint it is installing and names a private descriptor-handoff socket. The separate handoff passes exactly the call and completion descriptors in one Unix datagram, bound to the mapping-plan digest. A monitor checks the endpoint, grant, epoch, digest, descriptor count, backing identity, and exact byte length before it retains the mapping. Exact installation replay reuses the same backing objects; changed authority or changed descriptors are refused. See Fd handoff.

The call header

A call on the ring is a compact header and its payload:

Field Holds
Version and kind The admitted compact-header version and whether the frame is a call or completion
Grant slot and generation The grant the call runs under
Channel epoch The live channel generation in which the frame is valid
Attempt correlation A fixed, domain-separated correlation derived from AttemptId
Target handle The optional handle slot and generation being called
Export and method ordinals The export and method, by stable ordinals
Deadline The call's deadline
Flags Call flags
Payload length Length of the encoded arguments
Attachment identity Count, total bytes and ordered canonical descriptor-set digest

The hot path reads ordinals, slots and generations. Policy documents, method names and module lookups are resolved before a channel exists. Every field that crosses a boundary facing block code is validated by the receiving monitor, including offsets and lengths. A 160-byte slot carries an 8-byte sequence, the 128-byte header and 24 bytes of inline payload, so arguments larger than 24 bytes travel through sealed attachments.

Bulk data

Data Crosses as
Raw bytes A sealed memfd attachment with offset, length, rights and generation
Columnar data Arrow IPC in a sealed memfd, or a bounded stream
CPU tensors An imported host-memory buffer with a TensorLayoutV1

A buffer is zeroed before it is reused, so a buffer released by one tenant carries none of its bytes to the next. Library-native views such as Arrow C Data, DLPack capsules and device pointers stay local to the cell that created them. See Bulk attachment lane and Local views only.

A stream moves between process cells as a bounded sealed batch. Its manifest binds the stream generation, contiguous item sequences, each encoded range and digest, the complete content digest and any terminal declaration. The consumer monitor admits the complete manifest and mapping before it exposes an item. Nucleus authority then commits the delivered item records as one transaction, so a refused item leaves the stream's ordering and credit unchanged.

Bounds and backpressure

Rings, frames and attachment counts are bounded. A call spends call credit and byte credit from the channel grant exactly as it does on the cell control channel, and a full ring is backpressure to the sender. See Credit backpressure, Call completion ring and The memory model.

When a cell dies

A cell-epoch death invalidates the host's mapping ownership immediately. The surviving endpoint is revoked through the authenticated control channel, while the dead endpoint receives an explicit death-invalidation outcome in nucleus authority. The old mapping identity remains bound to its retired epoch and is refused in every other epoch.

A ring is reset after that invalidation, and its attachments are reclaimed and zeroed before reuse. Calls in flight are classified from the monitor's own dispatch and completion receipts, as on the reference path. See Ring reset and attachment reclamation.

Same behaviour as the reference path

The shared-memory channel changes how bytes move. Task states, handle semantics, cancellation outcomes, fault classifications and evidence events are identical on both transports. See Semantic equivalence.