Skip to main content

Module ipc

Module ipc 

Source
Expand description

Inter-Process Communication (IPC) subsystem.

See also: IPC Mechanisms Guide for architecture diagrams and usage patterns.

Strat9-OS uses two complementary IPC mechanisms:

§1. IPC Ports (synchronous message-passing, service endpoints)

Each port has a bounded FIFO queue of 64-byte IpcMessages. Senders block when the queue is full; receivers block when empty. Ports are owned by a single task and accessed via syscalls:

  • SYS_IPC_CREATE_PORT (200) : create a new port
  • SYS_IPC_SEND (201) : send a message to a port
  • SYS_IPC_RECV (202) : receive a message from a port
  • SYS_IPC_CALL (203) : send and wait for reply
  • SYS_IPC_REPLY (204) : reply to an IPC call
  • SYS_IPC_BIND_PORT (205) : bind a port to the namespace
  • SYS_IPC_UNBIND_PORT (206) : unbind a port

§2. Typed MPMC sync-channels (IPC-02)

channel::channel<T>(capacity) creates a typed Multi-Producer/Multi-Consumer channel for kernel-internal use. channel::SyncChan provides a symmetric IpcMessage channel exposed to userspace silos via:

  • SYS_CHAN_CREATE (220) : create a channel
  • SYS_CHAN_SEND (221) : send (blocking)
  • SYS_CHAN_RECV (222) : receive (blocking)
  • SYS_CHAN_TRY_RECV (223) : receive (non-blocking)
  • SYS_CHAN_CLOSE (224) : destroy the channel

§3. Transport layer (N1/N2/N3)

The transport module provides a unified trait-based IPC transport layer with three levels of isolation (TypeSafe, LockFree, MMU). lockfree_ring implements the N2 SPSC ring buffer. mailbox implements the N1 intrusive mailbox.

Re-exports§

pub use channel::channel;
pub use channel::create_channel;
pub use channel::destroy_channel;
pub use channel::get_channel;
pub use channel::ChanId;
pub use channel::ChannelError;
pub use channel::Receiver;
pub use channel::Sender;
pub use channel::SyncChan;
pub use lifecycle::MultiHandleDestroyError;
pub use lifecycle::MultiHandleResource;
pub use lockfree_ring::LockFreeRing;
pub use mailbox::IntrusiveMailbox;
pub use port::create_port;
pub use port::destroy_port;
pub use port::get_port;
pub use port::IpcError;
pub use port::Port;
pub use port::PortId;
pub use semaphore::create_semaphore;
pub use semaphore::destroy_semaphore;
pub use semaphore::get_semaphore;
pub use semaphore::PosixSemaphore;
pub use semaphore::SemId;
pub use semaphore::SemaphoreError;
pub use shared_ring::create_ring;
pub use shared_ring::destroy_ring;
pub use shared_ring::get_ring;
pub use shared_ring::RingError;
pub use shared_ring::RingId;
pub use shared_ring::SharedRing;
pub use transport::IpcConsumer;
pub use transport::IpcNotification;
pub use transport::IpcProducer;
pub use transport::IpcTransport;
pub use transport::TransportCapabilities;
pub use transport::TransportConfig;
pub use transport::TransportCreateResult;
pub use transport::TransportEndpoint;
pub use transport::TransportId;
pub use transport::TransportLevel;
pub use transport::TransportManager;

Modules§

channel
Typed MPMC blocking channel for IPC between kernel tasks and silos.
lifecycle
lockfree_ring
Lock-free single-producer single-consumer ring buffer for zero-copy IPC.
mailbox
N1 IntrusiveMailbox : lock-free LIFO mailbox for kernel-internal IPC.
message
port
IPC Port : a kernel-managed message queue with blocking send/recv.
reply
IPC call/reply support : both synchronous (blocking) and async (ring-based).
semaphore
shared_ring
test
IPC ping-pong test (Port-based) + MPMC SyncChannel test (IPC-02).
transport
IPC transport layer: traits, dispatch enum, and manager.

Structs§

IpcMessage
Fixed-size IPC message (256 bytes, 64-byte aligned).