modus
Menu
On this page

The entry twin

A module that the process frames starts several times, to show the shared code of a module and a page that two processes share (package modus:twins). The value MODE of its context says what it does.

What it is for. Two facts of the memory of the system need a second process to show them: the code pages of one module are shared between the processes that run it, and they cannot be written; and one page that two processes map is one frame. frames reads its own page table and the counts of the kernel while its twins run.

Start: only frames starts it, from the boot image. Its row of start_grant_sets has no grant. It has no window and writes nothing on the log.

twin module with an entry

Hash
bae4bdc9c1a769a12126b78529b697dbb8e3545dfe237ce1a4416aced0816487
Size
32768 bytes
Exports
0
Imports
0
Imported by
0
License
MIT

A module that the process frames starts several times, to show the shared code of a module and a page that two processes share (package modus:twins)

FactValue
KindModules with an entry
Sourcesrc/modules/demonstrations/twin
Boot imageyes: in the boot image, 32768 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 twin: it does what its mode says, then sleeps until frames stops it

entry

entry()

The entry of twin: it does what its mode says, then sleeps until frames stops it.

  • Twin_Mode.Write_Page: it maps the shared page, writes the agreed word in it, and wakes frames, which waits on that word. A page that does not map stops it with Failed.
  • Twin_Mode.Write_Code: it writes one byte in its own code. The page has no right Write, so the kernel stops the process as its own fault: the expected result.
  • Twin_Mode.Wait: it only sleeps, as one more process that shares the code of the module.
  • a word that names no mode: it writes a line and stops with Refused.
Form
The entry of the module: one parameter, an address, fixed by the contract.
Source
src/modules/demonstrations/twin/main.odin:33

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 child of frames: its starter gives it its handles.
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