kernel: v4 waits for a key in arch_halt(), not a spin (#151); Try it deployed #153

Merged
rajames merged 5 commits from StarForth-v4.0.0 into master 2026-11-08 01:59:30 +00:00
Owner

What and why

#151: an idle StarshipOS no longer keeps a CPU core 100% busy. The v4 system waited for a key -- sk_v4_readline() with nothing typed, sk_v4_identity_wait() headless until Zuse -- in arch_relax(), a spin. Both now wait in arch_halt() (hlt; wfi on aarch64 and riscv64) until the next interrupt; the heartbeat's timer, ISR-driven on all three, wakes them at 100 Hz, so a key is still seen within a tick. Found when two Try-it visitors starved the server's wikis (Captain Bob, 2026-11-08: "Fix the kernel problem").

Also, since #148 (all [skip ci] on the branch until now):

  • demo/DEPLOY.md: the server checklist for Try it, as run on 2026-11-08 -- with disabling the ttyd package's own login service first
  • demo/starshipos-demo.service: all sessions together one core at the lowest priority, 1 GiB (sized for today's server; can be relaxed once this fix is deployed)
  • the .com: "Try it" in the navigation of Home and Inquiries (#117, from the design canvas)
  • FABRIC-3 XLVIII.4-5: Try it deployed and checked from outside; this fix, measured

Closes #151. Part of #116.

Acceptance

The Acceptance check runs on this pull request. By hand, on this tree:

  • Logs committed in logs/: amd64 20261108-005539, aarch64 -005753, riscv64 -010136 (POST 538/538, dict_hash=0xfec8c47cfc6f437f on all three, 7 ok typed and answered), the stick loaded high, test-32 (39 programs, 0 failures); idle at the prompt for 20 s, QEMU at 1% of a core on all three (was 100%; aarch64 -011614, riscv64 -011931)
  • Hardware this was tried on, if any: none

The record

  • docs/fabric/FABRIC-3.md XLVIII.4-5
  • CHANGELOG.md -- for the alpha.4 entry
  • Nothing in this PR is a fix nobody asked for (.claude/CLAUDE.md, Hard Rules) -- #151, asked for 2026-11-08

🤖 Generated with Claude Code

https://claude.ai/code/session_01GE3SDvQn5EoxdGufk84zz2

## What and why **#151: an idle StarshipOS no longer keeps a CPU core 100% busy.** The v4 system waited for a key -- `sk_v4_readline()` with nothing typed, `sk_v4_identity_wait()` headless until Zuse -- in `arch_relax()`, a spin. Both now wait in `arch_halt()` (`hlt`; `wfi` on aarch64 and riscv64) until the next interrupt; the heartbeat's timer, ISR-driven on all three, wakes them at 100 Hz, so a key is still seen within a tick. Found when two Try-it visitors starved the server's wikis (Captain Bob, 2026-11-08: "Fix the kernel problem"). Also, since #148 (all `[skip ci]` on the branch until now): - `demo/DEPLOY.md`: the server checklist for Try it, as run on 2026-11-08 -- with disabling the ttyd package's own `login` service first - `demo/starshipos-demo.service`: all sessions together one core at the lowest priority, 1 GiB (sized for today's server; can be relaxed once this fix is deployed) - the .com: "Try it" in the navigation of Home and Inquiries (#117, from the design canvas) - FABRIC-3 XLVIII.4-5: Try it deployed and checked from outside; this fix, measured Closes #151. Part of #116. ## Acceptance The **Acceptance** check runs on this pull request. By hand, on this tree: - [x] Logs committed in `logs/`: amd64 `20261108-005539`, aarch64 `-005753`, riscv64 `-010136` (POST 538/538, `dict_hash=0xfec8c47cfc6f437f` on all three, `7 ok` typed and answered), the stick loaded high, `test-32` (39 programs, 0 failures); idle at the prompt for 20 s, QEMU at **1%** of a core on all three (was 100%; aarch64 `-011614`, riscv64 `-011931`) - [ ] Hardware this was tried on, if any: none ## The record - [x] `docs/fabric/FABRIC-3.md` XLVIII.4-5 - [ ] `CHANGELOG.md` -- for the alpha.4 entry - [x] Nothing in this PR is a fix nobody asked for (`.claude/CLAUDE.md`, Hard Rules) -- #151, asked for 2026-11-08 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01GE3SDvQn5EoxdGufk84zz2
rajames added this to the v4.0.0-alpha.4 milestone 2026-11-08 01:21:53 +00:00
rajames added 5 commits 2026-11-08 01:21:54 +00:00
Five steps on the server after #148: the checkout and amd64 build tools,
the demo's own Zuse, the image and the saved machine at 384 MiB, the
service, TLS and Apache for try.starshipos-f18.com; then the check from
outside and the .com's navigation link (#115, #116, #117).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GE3SDvQn5EoxdGufk84zz2
Ubuntu's ttyd package starts ttyd.service, which runs login on port 7681;
installed by step 1, it took the port, and try.starshipos-f18.com served
the server's login prompt until it was disabled (2026-11-08). Step 4 now
disables it first and checks what listens on 7681. And the check from
outside, done: ready in 1.5 s, 7 ok, 49 ok, the third visitor busy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GE3SDvQn5EoxdGufk84zz2
An idle StarshipOS guest keeps a host core 100% busy (measured 2026-11-08:
QEMU at 100% of a core, 148 MiB, the guest idle at its prompt; #151).
starshipos-demo.service: CPUQuota=100% and Nice=19 for all sessions
together, MemoryMax=1G -- sized for this server, where the old 300% and 4G
let two visitors starve both wikis and Gitea. DEPLOY.md says how to apply
it. FABRIC-3 XLVIII.4: Try it deployed and checked from outside; the ttyd
package's own login service; #151, #152.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GE3SDvQn5EoxdGufk84zz2
The canvas's Home and Inquiries artboards gain a 'Try it' link (canvas
versions 12, 13); canvas/ copies them, build.py rebuilds the pages, and
install.sh put them on the wiki. Checked as a visitor: the home page, the
link, the Try it page in 1.1 s, its framed console Ready. FABRIC-3 XLVIII.4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GE3SDvQn5EoxdGufk84zz2
kernel: v4 waits for a key in arch_halt(), not a spin (#151)
Build / Image RASPI (push) Successful in 3m9s
Build / Image PC (push) Successful in 4m27s
Build / Image MILKV (push) Successful in 3m18s
Build / v4 tests (32- and 64-bit cells) (push) Successful in 10m27s
Acceptance / Acceptance (pull_request) Successful in 15m15s
1928d53b6b
An idle StarshipOS kept a CPU core 100% busy: sk_v4_readline(), with
nothing typed, and sk_v4_identity_wait(), headless until Zuse, waited in
arch_relax(). Both now halt until the next interrupt (hlt; wfi on aarch64
and riscv64): the heartbeat's timer, ISR-driven on all three, wakes them at
100 Hz, so a key is still seen within a tick.

Idle at the prompt, QEMU's CPU: 100% -> 1% of a core on amd64, 1% on
aarch64 and riscv64. Acceptance passes: amd64 logs/20261108-005539, aarch64
-005753, riscv64 -010136 (POST 538/538, one dict_hash, 7 ok), the stick
loaded high, test-32 (39 programs, 0 failures). FABRIC-3 XLVIII.5.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GE3SDvQn5EoxdGufk84zz2
rajames merged commit f747ab78a6 into master 2026-11-08 01:59:30 +00:00
Sign in to join this conversation.