|
CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
|
A Psyclone system scales along two axes without changing a line of crank code: spaces (more processes on one machine) and nodes (more machines). In both cases the placement is a PsySpec attribute — the modules themselves are oblivious.
Every OS process attached to a node is a space (cmlabs::PsySpace). All inter-process state — component registries, message stores, queues — lives in named shared-memory segments (cmlabs::MemoryManager), which is what buys crash isolation: a space can die without corrupting the rest of the system, and can re-attach on restart.
Any catalog, whiteboard or module can be placed in a process separate from the main node process:
If the space does not already exist it is started automatically as a separate system process, and it is destroyed when the node shuts down. A node can have any number of spaces; if a component in one space performs an illegal action and crashes it, only the components in that space are affected. Runnable demos: Examples/adhoc.xml (a module in an external space between two in-node modules) and Examples/externals.xml.
Because same-node message transport goes through shared memory — a cmlabs::DataMessage is one flat allocation copied verbatim — crossing a space boundary costs a memory copy, not serialisation.
The external-module program in Examples/src/ExternalModules.cpp shows the manual version of the same idea: any executable you write can create a PsySpace, cmlabs::PsySpace::connect() to a running node by port, obtain a cmlabs::PsyAPI with cmlabs::PsySpace::getCrankAPI() and behave exactly like an internal crank — including detecting disconnection and re-attaching (see Writing a Module (Crank)).
A <node> entry declares another Psyclone runtime that belongs to this system, and node= attributes place components on it:
Examples/multinode.xml runs the full ping-pong / signals / catalogs test suite with the two players, the whiteboards and the catalogs deliberately split across two nodes; Examples/multinodesimple.xml is the reduced version. Everything from Core Concepts carries over unchanged:
For quick experiments you don't even need a second machine or spec: ./Psyclone psytest=N spawns N nodes on the local computer and spreads the test modules across them automatically.
Node-to-node and external-client communication is built on the CMSDK networking stack — the same stack available to your own programs: