modus
Menu
On this page

The entry randomness

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

The random bytes of the system, where they come from, shown. The design: Randomness.

The root service gathers the seed of the system at its start, from the sources of the processor, mixes in the bytes of the entropy device when the machine has one, and gives this process the facts of that gathering (the values 0 to 7 of its context): which sources were there, how many values each one gave, how many it refused, and the strength that the seed can claim. Like each process, this one has its own generator, seeded by its starter (the values 9 to 12). The window shows both, a live draw of the stream, the counts of each byte value in 1 MiB, and the speed of the generator.

What it is for. It shows where the random bytes of a process come from, and what the system claims of them: the strength of the seed is a fact that the root service measured, not a promise. A process that makes a key (remote, quic_echo, unlock) refuses a seed under the strength that it needs; this process shows that strength.

Start: start("randomness") in the console, or the bar of the desktop. Its row of start_grant_sets has no grant: the root service writes the facts of the seed into its context because of its name, and these are facts, not the seed.

What a reader sees: the sources of the seed (rdseed, rdrand, the jitter of the cycle counter, the entropy device) with their counts, the strength, a live draw of the stream every 500 ms, the mixes of the fresh bytes page, the 16 bars of 1 MiB counted by the high 4 bits of each byte, and the speed. The log has:

  • "randomness: the seed of the system: strength ...; the first bytes of the stream of this process: ...";
  • "randomness: the entropy device: N bytes mixed after the gathering; refused reads: N", or "randomness: the entropy device: absent";
  • "randomness: 1 MiB by the high 4 bits of each byte: from A to B in each of 16 (the mean is 65536)";
  • "randomness: the generator: 4 MiB in T us, R MB/s";
  • "randomness: the fresh bytes of the root service are mixed into the generator of this process, at the change C of its page", once, at the first mix.

What it does not prove: even bars are no test of quality; a weak generator gives them too. The quality of the seed rests on the sources of the processor.

See: Fresh bytes for a running process in the repository, Randomness: The seed of the system, and what is claimed

randomness module with an entry

Hash
27f63774b5ec3a1f443b6fa9da3472d53aa6aa3acdf2cb2085b49a541d4e2c55
Size
175363 bytes
Exports
0
Imports
1
Imported by
0
License
MIT

The random bytes of the system, where they come from, shown

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

randomness drawing

Exports

ExportWhat it does
entry()The entry of randomness: it shows the seed, counts 1 MiB, measures 4 MiB, then draws a live stream every 500 ms for ever

entry

entry()

The entry of randomness: it shows the seed, counts 1 MiB, measures 4 MiB, then draws a live stream every 500 ms for ever.

With no seed in its context, it writes "randomness: no random seed in the context" and stops with Refused, as for a seed strength that names no strength; with no window, it stops with Failed. The counts and the measure run once, in the main thread, after the first picture.

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

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
GrantsnoneThis service writes the facts of the seed of the system in its values: facts, not the seed (start_values_of_the_name).
Other terms of its start grant setnone
Budget that it asks for
  • working memory pages 1026
  • pages of its threads 72
  • pages of the pictures of its window 4088
  • pages of the module and its imports from the files of the build
  • processes the least
  • threads the least
The least budget of 2048 pages, in which it ran before it stated its window, less that window at the scale 1 (1022 pages): its module, its stack, its tables, its measure and its glyph memory. The tool counts the window at the largest scale. See: Module contract: The budget that a module asks for

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

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