modus
Menu
On this page

The entry tables

Tables and bytes as parameters: one description, three ways to call. The design: Module contract: Tables and bytes as parameters.

This process calls the exports of the module sample with tables in its own memory, in three ways, with the same arguments: a direct call of the module that it loaded in its own address space, an isolated call of a call host that it starts, and an isolated call of the service "sample" (the same module, started by the root service as a process). It shows each answer, the hostile cases, and the cost of each way for tables of 64, 1024 and 65536 records of 40 bytes.

What it is for. It proves that one description of an export serves the three ways of a call with the same answer: the caller chooses the isolation, and the module has no code of its own for it. A table travels as records of fixed size, so the callee checks a count and a size, never a pointer of the caller. The hostile cases are exports of the module hostile_exports that lie on purpose: the call path must refuse each one.

Start: start("tables") in the console, or the bar of the desktop.

Grants, as the root service gives them:

  • Image: the boot image, read-only: it loads sample and hostile_exports into its own address space, and starts their call hosts from it.
  • Connect: a ring to the root service that serves Connect to the service sample only. The root service starts sample on demand.

What a reader sees: a table with one row for each case and one column for each way, the hostile cases, and the measures. The log has "tables: the ways: direct ready, call host ready, service ready", one line for each hostile case, the time of sum_values in each way for 64, 1024 and 65536 rows, and "tables: ok, N cases in 3 ways and M hostile cases", or "tables: wrong answer: ..." for each wrong answer.

What it does not prove: a way that does not start is shown as "refused" and its cases fail; the process does not retry it.

tables module with an entry

Hash
c926c5cd4370e001329770d974320385582df8c9e22f35ee5ad0ec1edece4567
Size
377551 bytes
Exports
0
Imports
0
Imported by
0
License
MIT

Tables and bytes as parameters: one description, three ways to call

FactValue
KindModules with an entry
Sourcesrc/modules/demonstrations/tables
Boot imageyes: in the boot image, 377551 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 tables: it prepares the three ways, runs the cases, the hostile cases and the measures once, then shows the result for ever

entry

entry()

The entry of tables: it prepares the three ways, runs the cases, the hostile cases and the measures once, then shows the result for ever.

With no seed it stops with Refused, with no window with Failed. It loads sample here (the direct way), starts a call host of it (the second way), and connects to the service sample (the third way); a way that fails is marked refused and the process goes on. It does the same for hostile_exports, with no service. Then it fills a table of 65536 readings for the measures, runs everything, and writes the result.

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

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
GrantsIt loads sample, starts a call host of it from the boot image, and connects to the service sample. See: Module contract: Tables and bytes as parameters
Other terms of its start grant setcallable = {0 = "sample"}
Budget that it asks for
  • working memory pages 3603
  • pages of its threads 110
  • pages of the pictures of its window 5500
  • pages of the module and its imports from the files of the build
  • processes 3
  • threads 3
A table of 65536 readings in a memory object (640 pages), and two call hosts (sample, hostile_exports) with their threads: 2561 pages. And the glyph memory of its own copy of the text rendering, which draws its text by hand: 354 pages (display.TEXT_MEMORY_PAGES). And the picture of its window, which it draws by hand at its logical size: 1000 x 704 pixels of 4 bytes, 688 pages (interface.hand_picture_pages). 2561 + 354 + 688 = 3603.

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 (its line); 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).

sum_values procedure of the package sample

sum_values :: proc "c" (readings: ^system.Table_To_Read(Reading)) -> i64

sum_values gives the sum of the values of a table of readings.

src/modules/demonstrations/sample/sample.odin:205