modus
Menu
On this page

The entry frames

The source src/modules/demonstrations/frames built with the setting DRAWING_THROUGH_MODULE=true. The text after this paragraph is the comment of that source.

A demonstration of paging as a tool of the system (paging, second part).

Pages on first use: a memory object takes no page frame until a process uses a page; the budget pays at creation, so an access never fails. The shared code of a module: processes that run one module map one memory object for its code; a write to it is a page fault. The window shows each case and the answer of the kernel, and the measures.

The process needs the grant to inspect the machine (it reads the page table of its own half), and the boot image (it starts the process twin).

What it is for. It shows two uses of paging that the system relies on. A page on first use costs its frame only when a process touches it, and the budget pays at creation, so no access fails for lack of memory. Shared code lets several processes that run one module map one memory object for its code, read only: the code is in memory once, and a process that writes to it faults alone.

What a reader sees. Start it from the start menu, or with start("frames") in the console. The window has one row for each case, with the answer of the kernel, then the measures. Its lines in the log: the time to create and map 8192 pages with each frame now and with pages on first use; the time of the first use of a page; the time to start a twin with its own copy of the module and with the shared code; and the pages that 4 twins cost each way (frames: 4 twins: ...).

Its grants: Inspect, to read the page table of its own half, and Image, to start the process twin from the boot image. Its budget holds 12288 pages: 8192 pages at a time, and 5 twins.

What it does not prove. The times are measures of the host of the run; no case checks a speed.

frames module with an entry

Hash
3701c68aef34336ab261eb52772227e0effce6d2dc49052b9a0953db05c34ebe
Size
215191 bytes
Exports
0
Imports
1
Imported by
0
License
MIT

A demonstration of paging as a tool of the system (paging, second part)

FactValue
KindModules with an entry
Sourcesrc/modules/demonstrations/frames
Boot imageyes: in the boot image, 215191 bytes in this build
Build settings
  • DRAWING_THROUGH_MODULE=true
Imports
Imported bynone

Neighbours

What it imports, at its left, and what imports it, at its right: the part of the module graph that touches it.

frames drawing

Exports

ExportWhat it does
entry()runs each case and each measure once, writes the lines of the measures, then keeps the window open until the process is stopped

entry

entry()

entry runs each case and each measure once, writes the lines of the measures, then keeps the window open until the process is stopped. With no random seed (it gives the seed of each twin), it stops with Refused; with no window, with Failed.

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

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 reads its own page table, and starts its twins from the boot image.
Other terms of its start grant setnone
Budget that it asks for
  • working memory pages 11800
  • pages of its threads 167
  • pages of the pictures of its window 2429
  • pages of the module and its imports from the files of the build
  • processes 6
  • threads 6
8192 pages at a time, and five twins: 11446 pages. And the glyph memory of the copy of the text rendering of the drawing module, which draws its text: 354 pages (display.TEXT_MEMORY_PAGES). 11446 + 354 = 11800.

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).