summaryrefslogtreecommitdiffstats
path: root/docs/adr/0005-persistent-terminal-and-disk-controller.md
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-08-17 19:56:24 +0200
committersalmonik <salmonik@tuta.io>2026-08-17 19:56:24 +0200
commit126d5b2e55dca93e024f5654fed6fae37a012369 (patch)
treea74ad41c98c121a7bc37299b8a4d1d336e0cd2c5 /docs/adr/0005-persistent-terminal-and-disk-controller.md
parentwm: keep windows in place when the console scrolls beneath them (diff)
downloadrs-dos-126d5b2e55dca93e024f5654fed6fae37a012369.tar.gz
rs-dos-126d5b2e55dca93e024f5654fed6fae37a012369.zip
Terminal-app design (ADR 0005) + disk-write controller
- ADR 0005: persistent home terminal (full-screen, chrome-less, bottom-pinned), F1 terminal windows, per-instance vt/tty/shell, queue-based input for all terminals, and the disk controller - Glossary: add the Terminal term; update Task/App for the new model - Add a re-entrant disk lock (DiskGuard over the preemption-depth counter) and wrap all fs/fat mutating operations per-call
Diffstat (limited to 'docs/adr/0005-persistent-terminal-and-disk-controller.md')
-rw-r--r--docs/adr/0005-persistent-terminal-and-disk-controller.md48
1 files changed, 48 insertions, 0 deletions
diff --git a/docs/adr/0005-persistent-terminal-and-disk-controller.md b/docs/adr/0005-persistent-terminal-and-disk-controller.md
new file mode 100644
index 0000000..dee62d1
--- /dev/null
+++ b/docs/adr/0005-persistent-terminal-and-disk-controller.md
@@ -0,0 +1,48 @@
1# ADR 0005 — Persistent terminal program, per-instance shell/vt, and a disk-write controller
2
3## Status
4
5Accepted.
6
7## Context
8
9The GUI (ADR 0004) left the console as a special "layer 0" rendered
10straight into the shared shadow, with a single shell (task 0) reading a
11global keyboard buffer and being the only thing that touches the disk. We
12want a TempleOS-inspired **persistent terminal program**: a full-screen,
13always-present command line, plus the ability to spawn additional terminal
14windows.
15
16## Decision
17
18- **Home terminal** — a real window (own pixel buffer, composited by the
19 WM) that is full-screen, chrome-less (no title bar / minimize / close),
20 bottom-pinned (never raised), and never closes. It is the persistent
21 desktop.
22- **F1 terminals** — ordinary windows (640×400, title bar, movable,
23 closable via F4 and the close button) running additional shell instances.
24- **Per-instance** — `vt` becomes a per-instance `Terminal` (cell grid,
25 cursor, ANSI parser, scroll); `tty` and `shell` become per-instance too.
26 Each terminal owns one of each.
27- **Input** — every terminal's shell reads `TaskMsg::Key` from its own task
28 queue (routed by the WM's input pump to the focused window). No terminal
29 reads the global keyboard buffer; there is one input path for all.
30- **Rendering** — a terminal renders its text grid into its window's pixel
31 buffer; the WM composites it like any other window. This supersedes the
32 scroll-hook workaround from ADR 0004.
33- **Disk controller** — `fs`/`fat` remain the disk owner, but every
34 mutating operation is wrapped in a re-entrant preemption-disable lock,
35 serializing concurrent access from multiple shells. Per-call granularity.
36- **Background** — a terminal's running command keeps producing output into
37 its buffer while unfocused (free from preemptive multitasking plus
38 per-terminal buffers).
39
40## Consequences
41
42- Positive: the console is a first-class program; multiple terminals share
43 one coherent input path; concurrent disk access is safe.
44- Negative: the preemption-disable disk lock stalls the scheduler during
45 disk I/O (fine on QEMU's RAM-backed disk; revisit for real hardware).
46- Negative: a substantial refactor of `vt`/`tty`/`shell` from globals to
47 instances.
48- The "only the shell touches the disk" assumption is removed.