The program terminal
The terminal: it shows the text that a program gives as records, and it gives the keys of the person to that program (support/terminal).
The terminal starts no program. The root service starts a program and its terminal, and gives the same terminal ring and text region to the two. The terminal holds a surface, these two memory objects, and a handle that reads the state of the program: it has nothing of the role of the program. The name of the program, the size of the text and what the window shows are values of its context.
Keys: Page Up and Page Down move the view. Each other key goes to the program, and the view returns to the last lines.
Two threads:
the reader It reads the records of the terminal ring and keeps the
lines. It owns the lines: no lock exists.
the drawer The first thread. At the rate of the screen it asks the
reader for a view: the cells of the rows that the window
shows. Then it draws the view. The reader makes the view
between two groups of records: some microseconds.
The surface has two pictures: the compositor never reads
a picture that the drawer changes.
The reader does not wait for a picture, so the program that writes does not wait for a picture. A line that the window does not show costs one copy of its bytes, and no pixel.
The lines that the terminal keeps are in three areas of fixed size: the lines, the runs, the bytes. Each area starts again at its first place when it is full: the oldest lines go.
| Fact | Value |
|---|---|
| Source | programs/terminal |
| 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 = 8192, programs = 1, threads = 2} | The lines that it keeps. |
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.
