modus
Menu
On this page

The entry node

One node of the rings demonstration (package relay). It has four memory objects and no other handle: it cannot draw, and it cannot see the other nodes. It communicates only through its rings.

What it is for. It shows that a process with no grant but four memory objects is still useful, and still contained: it passes records from the ring before it to the ring after it, and it can do nothing else. The process rings starts six nodes in a circle from the boot image and draws what each one holds.

Start: rings starts it from the boot image and gives it its four handles. Its row of start_grant_sets has no grant: a start by the root service does not give it these handles, so it has no use there.

Its context, as the package relay names the places:

  • GRANT_BEFORE, GRANT_AFTER: the ring that it reads, the ring that it writes;
  • GRANT_CONTROL: a ring from rings, which can put a record in the circle;
  • GRANT_STATE: a shared page where the node says what it holds, since when, and if the ring after it is full;
  • VALUE_WORK_TIME: the milliseconds that it holds each record.

It writes nothing on the log and has no window.

node module with an entry

Hash
72343ba2f059bd2327f1a367e7ee2fcba3bb8e7dfd6e196af9dbffac662a1308
Size
16384 bytes
Exports
0
Imports
0
Imported by
0
License
MIT

One node of the rings demonstration (package relay)

FactValue
KindModules with an entry
Sourcesrc/modules/demonstrations/node
Boot imageyes: in the boot image, 16384 bytes in this build
Build settingsnone: the defaults of the source
Importsnone
Imported bynone

Neighbours

It imports no module, and no module imports it. The module graph shows it with the other modules that have no edge.

Exports

ExportWhat it does
entry()The entry of a node: it maps its four memory objects, then passes records for ever

entry

entry()

The entry of a node: it maps its four memory objects, then passes records for ever.

A memory object that does not map stops it with Failed. Each turn:

  1. 1. a record that it held for its work time goes to the ring after it; a full ring refuses it, and the node keeps it and marks itself blocked;
  2. 2. with no record held, it takes one from the control ring first, then from the ring before it, adds one to its count of hops, and holds it;
  3. 3. it waits for one thing only: a record, the end of its work, or room in the ring after it.

A node never stops by itself: rings stops it.

Form
The entry of the module: one parameter, an address, fixed by the contract.
Source
src/modules/demonstrations/node/main.odin:46

Read from the source of the module, as the build reads it to describe the exports (tools/modustool/build/describe.odin).

What the root service gives it

WhatValueAs the root service says
GrantsnoneA node of rings: its starter gives it four memory objects.
Other terms of its start grant setnone
Budget that it asks for
  • the least budget
No MODULE_BUDGET in its source: it asks for the least budget.

The start grant set is read from start_grant_sets in src/modules/system/root/start_grant_sets.odin. The stated budget is read from the constant MODULE_BUDGET of the source of the module; the build adds the counted parts and writes the sum in the module (tools/modustool/build/budget_count.odin); the root service accepts it up to the largest budget of a process, and adds the limits of processor time and of log records (src/modules/system/root/budgets.odin).

start_grant_sets global variable of the package root

start_grant_sets := [?]Start_Grant_Set_Row {...}

The start grant set of each module of the boot image, with the reason of each.

src/modules/system/root/start_grant_sets.odin:73

GRANT_BEFORE constant of the package relay

GRANT_BEFORE :: 0

The roles of the context of a node.

src/library/modus/relay/relay.odin:13

GRANT_AFTER constant of the package relay

GRANT_AFTER :: 1

Memory: the ring to the node after.

src/library/modus/relay/relay.odin:14

GRANT_STATE constant of the package relay

GRANT_STATE :: 3

Memory: one State record.

src/library/modus/relay/relay.odin:16

VALUE_WORK_TIME constant of the package relay

VALUE_WORK_TIME :: 0

Milliseconds that the node keeps a record.

src/library/modus/relay/relay.odin:17