The entry locks
The source src/modules/demonstrations/locks built with the setting DRAWING_THROUGH_MODULE=true. The text after this paragraph is the comment of that source.
The checks and the measures of the locks of the kernel.
The process starts four processes locker. Each one works on its own objects only: a kernel entry of one locker touches no object of another locker. So a locker waits for another one only when the kernel makes it wait. With 1, 2 and 4 lockers at one time, each locker enters the kernel a fixed count of times, then writes a fixed count of pages for the first time. Then two threads of this process wake each other with the word wait a fixed count of times, alone, then while two lockers enter the kernel. The window shows the counts, and the waits of each lock of the kernel in each run. In a measure run each run has a fixed time and no count, and the numbers are the kernel entries, the page faults on first use and the wakes in one second.
The process checks the counts: the kernel counted each entry of a locker, each page returned to its budget, each free page is in a budget or reserved, and no wake was lost. It does not check a speed.
The process needs the grant to inspect the machine, and the boot image (it starts the lockers).
What it is for. It shows how the kernel behaves when many processes enter it at one time: the count of the waits of each lock of the kernel, one run queue for each processor, and the word wait that loses no wake under load. The checks are of counts and of order; the rates are measures.
What a reader sees. Start it from the start menu, or with start("locks") in the console. The window shows the kernel entries and the page faults of the check with 1, 2 and 4 lockers, the wakes of the word wait between two threads alone and under load, and, for each run, the waits of each lock. In a measure run (modustool measure) the numbers are in one second. The log gets one line for each locker (locks: locker 1 counted ... entries, the kernel ...), the lines of the stress case and of the case of the frames, then the summary.
Its grants: Inspect, to read the counts of the locks and of the kernel entries, and Image, to start the process locker. Its budget holds 9216 pages and 8 processes: 4 lockers of 1024 pages, then 3 at a time in the stress case.
What it does not prove. A count of waits says how often a lock was contended, not how long: the times are printed as measures, and depend on the host of the run.
locks module with an entry
- Hash
d408eb83f39506f240bad1b768fd8b651f8fe9b4b7e2d74dddf4b03f74291027- Size
235223 bytes- Exports
0- Imports
1- Imported by
0- License
- MIT
The checks and the measures of the locks of the kernel
| Fact | Value |
|---|---|
| Kind | Modules with an entry |
| Source | src/modules/demonstrations/locks |
| Boot image | yes: in the boot image, 235223 bytes in this build |
| Build settings |
|
| Imports | |
| Imported by | none |
Neighbours
What it imports, at its left, and what imports it, at its right: the part of the module graph that touches it.
Exports
| Export | What it does |
|---|---|
entry() | starts the four lockers, runs the measures with 1, 2 and 4 of them, the word wait alone and under load, the stress case and the case of the frames, checks the counts, and writes the summary |
entry
entry()
entry starts the four lockers, runs the measures with 1, 2 and 4 of them, the word wait alone and under load, the stress case and the case of the frames, checks the counts, and writes the summary. It then keeps the window open until the process is stopped. With no random seed, it writes the reason on the log and stops with Refused; with no boot image, no memory for the board, or a locker that does not start, with Failed.
- Form
- The entry of the module: one parameter, an address, fixed by the contract.
src/modules/demonstrations/locks/main.odin:623
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
| What | Value | As the root service says |
|---|---|---|
| Grants | It reads the counts of the locks, and starts its lockers from the boot image. | |
| Other terms of its start grant set | none | |
| Budget that it asks for |
| Four lockers of 1024 pages, then three at a time of the stress case: 7745 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). 7745 + 354 = 8099. |
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).
