modus
Menu
On this page

The entry limits

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

A demonstration of the limits of a budget: processor time and log records. A process cannot take all the processor time or fill the log: each resource has a limit.

The process makes three budgets with a limit of processor time, and one thread on each budget. Each thread computes with no end. A fourth thread is on the budget of the process. The window shows the processor time that each budget used in the last second, against its limit. The budget of the process has a limit too, and what the three budgets use counts in it. Then the process writes 100 records on the log at once: its budget has 40 records for each second.

What it is for. It shows that a limit of a budget holds against a process that tries to take more: a thread that never waits gets no more than the processor time of its budget in each period, and a burst of log records past the limit is refused with No_Budget, so no process fills the log of the others.

What a reader sees. Start it from the start menu, or with start("limits") in the console. The window has one bar for each of the four budgets: the processor time that it used in the last second, against its limit. The log gets a line of the times used, then limits: ok, 4 budgets within their processor time, <count> log records written and <count> refused with <limit> for each second, or limits: wrong: .... The burst writes its records at the level debug.

Its grants: none. Its budget from the root service holds 2048 pages, 1 process and 5 threads, with a limit of processor time and of log records.

What it does not prove. The bars are measures: a loaded host gives a thread less time than its limit, and the check reads only that no budget used more than its limit. Under KVM the kernel does not charge the stolen time, so a loaded host does not raise a bar past its limit.

limits module with an entry

Hash
8663ffa529257de47122f8357ddff701a0bb05ca0f35f99f1e90532403ccc3b9
Size
149505 bytes
Exports
0
Imports
1
Imported by
0
License
MIT

A demonstration of the limits of a budget: processor time and log records

FactValue
KindModules with an entry
Sourcesrc/modules/demonstrations/limits
Boot imageyes: in the boot image, 149505 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.

limits drawing

Exports

ExportWhat it does
entry()writes the burst of 100 log records first and counts the accepted and the refused ones; it then makes the three budgets with a limit of processor time, starts one thread that computes with no end on each, and one on its own budget

entry

entry()

entry writes the burst of 100 log records first and counts the accepted and the refused ones; it then makes the three budgets with a limit of processor time, starts one thread that computes with no end on each, and one on its own budget. Each second it reads the processor time of each budget, draws the bars, and writes the summary on the log once. It never returns; with no window, it stops with Failed.

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

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
GrantsnoneThe limits of its own budget.
Other terms of its start grant setnone
Budget that it asks for
  • working memory pages 1760
  • pages of its threads 148
  • pages of the pictures of its window 1770
  • pages of the module and its imports from the files of the build
  • processes 1
  • threads 5
The working memory: the rest of the pages that the root service gave it by its name, once the tool counts its module, its threads and its window. Its small limits of processor time and of log records are an exception of the root service: a request holds no limit in time. 1406 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). 1406 + 354 = 1760.

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