The program budget
A demonstration of budgets (properties 2 and 20).
No operation creates an object from nothing: a budget pays for each memory object, each program and each thread. The root service gave this program a budget. The program creates objects until the kernel refuses, then frees them: each page returns. Then it takes a part of its budget for a new budget, and closes it: what the new budget held returns, and this budget pays for the objects that live.
| Fact | Value |
|---|---|
| Source | programs/budget |
| Boot image | in the boot image; the image is not built, so its size is not known |
| Imports | none |
| Imported by | none |
Exports
| Export | What it does |
|---|---|
| entry() |
Read from the source of the module, as the build reads it to describe the exports (tools/kerneltool/describe.odin).
What the root service gives it
| What | Value | As the root service says |
|---|---|---|
| Grants | {} | Not named in grants_of: the grants of each other program. |
| Budget: pages, programs, threads | {pages = 1024, programs = 1, threads = 4} |
Read from grants_of and things_of in programs/root/main.odin; budget_of in the same file adds the limits of processor time and of log records.
