The entry disk
The source src/modules/demonstrations/disk built with the setting DRAWING_THROUGH_MODULE=true. The text after this paragraph is the comment of that source.
A check and a measure of the block service, on a disk of its own that holds no data of a process. The contract: src/library/modus/contract/block.
The process reads and writes blocks in five runs: one block in each request, with one request in flight and then with 32. The check sends a fixed count of requests in each run, and no request must fail. In a measure run each run goes on for one second, and the process writes the blocks in one second. In the two it counts the kernel entries of the two processes for each request: its own entries (the system library counts them) and those of the block service (the command Statistics). Then it writes a pattern, flushes, reads it back and compares.
What it is for. It measures the cost of a disk under this design: a block service that is a process, a block ring between two processes, and a data region that the device reads and writes directly. The kernel entries for each request show that the kernel is not on the path of the data: an entry is a wait or a wake, and one entry serves many requests when several are in flight.
What a reader sees. Start it from the start menu, or with start("disk") in the console. The window has one row for each of the five runs: a read or a write, the blocks in each request, the requests in flight, a bar of the requests that the check sent, and a bar of the kernel entries of this process and of the block service for 100 requests. In a measure run (modustool measure disk) the first bar is the blocks in one second. Its lines in the log:
disk: ok, the disk has <count> blocks, 64 blocks in one request at most;- one line for each run:
disk: read, 1 block in each request, 32 in flight: 256 requests, ...; in a measure run:... 32 in flight: <rate> blocks in one second, ...; disk: a read of 2 blocks from the last block: ..., the error record of a read past the end of the disk, which the process checks field by field;- one line for each word of a command record that names no command (None, one past the last command, the largest word):
disk: the command word 0 of the block ring: refused with Bad_Command and the record Unsupported of the word, and the next Info is served: as it must; disk: the window sent the command words 0, <the first word past the last display command> and 4294967295: the compositor read the three: as it must; the compositor writes its own line at the first one, and the count when the window closes;disk: ok, 5 runs, 0 errors, write then read back: 0 wrong, ordisk: wrong: ....
Its grant: Scratch_Disk: a block service of the disk of the measures, and its block ring. The disk holds no data of a process, so the measure writes over it. The process has no store and no other disk.
What it does not prove. The numbers are those of virtio under QEMU on the host of the run, not of a real disk: they are printed as measures, and no test compares them to a bound. The measures use the first 4096 blocks (16 MiB) of the disk only.
disk module with an entry
- Hash
e6a6c04752640c0f2efde4a3f16eb660e2caddefa94f132264aeff6a65bdf60e- Size
171820 bytes- Exports
0- Imports
1- Imported by
0- License
- MIT
A check and a measure of the block service, on a disk of its own that holds no data of a process
| Fact | Value |
|---|---|
| Kind | Modules with an entry |
| Source | src/modules/demonstrations/disk |
| Boot image | yes: in the boot image, 171820 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() | runs the five runs once, shows them, then keeps the window open until the process is stopped |
entry
entry()
entry runs the five runs once, shows them, then keeps the window open until the process is stopped.
What it does, in order:
- 1. It opens a window, the block ring, and a data region of 256 pages (1 MiB, contiguous: the device reads and writes it).
- 2. It gives the data region to the block service through the block ring, and sends
Attach. The block service maps the ring when it starts; the process tries again each millisecond, until the hang bound. - 3. It asks
Infofor the size of the disk. - 4. It runs each of the five runs (
run): a count of requests, or one second in a measure run. - 5. It writes a pattern, flushes, reads it back and compares (
check). - 6. It reads 2 blocks from the last block of the disk, and checks the error record of the refusal: kind
Out_Of_Range, argument 1, value the count of blocks + 1, limit the count of blocks. - 7. It sends the three words that name no command to the block service and checks each answer (
block_words_check), then writes them on the ring of its window and waits until the compositor read them (window_words_check). - 8. It writes the summary line, then draws the window at each event.
The stop: with no window, no block ring, no data region, no block service, or a refused Attach, it writes the reason on the log and stops with Failed. Else it never returns.
- Form
- The entry of the module: one parameter, an address, fixed by the contract.
src/modules/demonstrations/disk/main.odin:425
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 measures the block service on the disk of the measures, which holds no data of a process: its writes destroy nothing. | |
| Other terms of its start grant set | none | |
| Budget that it asks for |
| The least budget of 2048 pages, in which it ran before it stated its window, less that window at the scale 1 (525 pages): its module, its stack, its tables, its blocks 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).
block_words_check procedure of the package disk
block_words_check :: proc "contextless" ()
block_words_check sends each refused word to the block service, checks.
window_words_check procedure of the package disk
window_words_check :: proc "contextless" (window: ^display.Window)
window_words_check writes each refused word on the ring of the window,.
