modus
Menu
On this page

The entry kernel_events

The events that the kernel sends to a process, case by case. The design: Architecture: Kernel events.

The kernel records its own work (the operations of the kernel entries, the switches of threads, the faults of processes, the waits for its locks) when a rule of the event table accepts an event, into one event ring for each processor, in a memory object of the process that gave the table. This process gives tables, runs a known load in children (this module, with a role), reads the rings, and checks the counts that must be exact:

  1. 1. No grant: a copy of the machine handle with no right is refused.
  2. 2. 16 rules are taken; a seventeenth rule is refused.
  3. 3. 1000 operations Memory_Size of one child: exactly 1000 records.
  4. 4. A thread of that child sleeps 20 times: a switch to it at each wake.
  5. 5. A child that faults once: one record of a fault that stops it.
  6. 6. "One in 10": exactly 100 records of 1000 operations.
  7. 7. A full ring: the records written and the lost count add up to 1000.
  8. 8. The table taken away: no record after it.
  9. 9. The address of a fault: 0 with a rule for every process, the address with a rule that names the child.
  1. 10. 1000 gives and ends of a table while the loaders of the load child enter the kernel on each processor: after each end, a pattern over the whole memory object of the rings stays whole.
  2. 11. The cost: kernel entries in one second of the load child, with its own count and time: with no rule, with a rule that names another process, with a rule for every process that matches nothing, and with a rule that accepts each of its operations; the records written plus lost must be 0 for the second and the third, and its count for the fourth.
  3. 12. The right revoked: the principal revokes the grant machine of this process (the console, in the scenario); the table ends with it, no record comes after, and Events_Set is refused.

The end of a table with its owner is a step of the scenario: the tool stops this process while its table is given, waits for the line of the kernel, and starts it again; the first table of the second run is taken (a table that the kernel had kept would make it Bad_State). This process is the one holder of the right Events: it gives no right on.

What it is for. A reader who wants to see what the kernel does for one process (its operations, its switches, its faults, its waits for a lock) asks for kernel events, with no change of the kernel and no cost when no event rule asks. This process checks that the counts are exact, that a rule that names another process costs nothing, and that the right Events holds.

What a reader sees. Start it from the start menu, or with start("kernel_events") in the console. The window has one row for each case. The log gets one line for each case, then kernel_events: ok, 12 cases: each count of the rings was exact, ..., or kernel_events: failed: <count> cases of 12.

Its grants: Events, the machine handle with the right Events, which gives an event table for every process, and Image, to start its children from the boot image. Its budget holds its window, an event ring for each processor, and two children at one time.

kernel_events module with an entry

Hash
9af7afd29eda4ad24a5fcda77a1d37212a90ad9788c607331e17b63600ec3249
Size
371025 bytes
Exports
0
Imports
0
Imported by
0
License
MIT

The events that the kernel sends to a process, case by case

FactValue
KindModules with an entry
Sourcesrc/modules/demonstrations/kernel_events
Boot imageyes: in the boot image, 371025 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()runs the role that the context names, for a child; else it runs each case in order, writes one line for each and the summary, then keeps the window open until the process is stopped

entry

entry()

entry runs the role that the context names, for a child; else it runs each case in order, writes one line for each and the summary, then keeps the window open until the process is stopped. The last case waits for the console to revoke its machine handle, in the scenario of the test.

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

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 gives the event table of the machine, and starts its children from the boot image.
Other terms of its start grant setnone
Budget that it asks for
  • working memory pages 2123
  • pages of its threads 186
  • pages of the pictures of its window 4500
  • pages of the module and its imports from the files of the build
  • processes 3
  • threads 7
Process_Create takes the process and its first thread from this budget. The tool counts its module, a stack and a thread area for each of its 7 threads, and its window. The working memory: its rings, 4 processors x (128 + 8192 x 64 bytes), 513; one shared page for each child, 2; the load child, 256; the child that faults, at the same time, 320, because it loads this whole module, whose image grows with the drawing code; its page tables; and the rest of the 3072 pages that it had before the tool counted. Processes: itself and two children at one time. Threads: its main thread, 1; the load child, its main thread and 4 loaders, 5 (taken from this budget when it starts, for its life); then either the child that faults or the thread that empties the rings, 1, never both at one time: 7. Its pages: 1769, 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). 1769 + 354 = 2123.

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