Days

Ports & mailboxes

Communication between models in the legacy Nexosim engine.

This page describes the legacy simulator. Exact-executor LPs exchange fixed Event values through per-LP queues and round outboxes instead.

Most Nexosim model communication uses typed message passing:

  • Mailbox<M> is the bounded inbound queue for a model instance.
  • Output<T> is a typed output port that can connect to one or more model inputs.
  • event_slot(...) and event_queue(...) are compatibility sinks that expose writer/reader handle pairs for tests and benches.

The main definitions are under crates/nexosim/src/ports.rs and crates/nexosim/src/simulation/mailbox.rs.

Connecting models

Legacy topology assembly connects an output to a handler and the target model's mailbox:

producer.output.connect(Consumer::handle, &consumer_mailbox);

Sending on that output invokes connected consumers at the current simulation time:

producer.output.send(message).await;

Delayed delivery uses the scheduler available through a model Context.

In the network model, a PacketSwitch output connects to an egress scheduler or endpoint handler. Scheduler output then connects to the downstream switch or endpoint, with optional wire and layer-2 stages inserted by topology construction. The concrete assembly is in legacy/src/topos/topo.rs.

Ports are the normal model boundary, but not the only coordination mechanism in the legacy engine. The application source uses Tachyonix channels, and scheduler/PFC bookkeeping shares atomic QueueState. See legacy/src/flows/app_source.rs and legacy/src/schedulers/state.rs. Models still own their protocol state; these explicit shared facilities should not be confused with the exact executor's LP ownership model.

On this page