An idle StarshipOS keeps a CPU core 100% busy: the idle loop polls, it never halts #151

Closed
opened 2026-11-08 00:38:40 +00:00 by rajames · 0 comments
Owner

Found (2026-11-08)

The demo machine (demo/qemu-args.sh: amd64, 384 MiB, TCG), booted to [zuse@Hera] ok> and left idle for 20 s: QEMU at 100% of one host core the whole time (148 MiB resident). With two Try-it visitors at once the server's two busy cores starved both wikis and Gitea (the .com's Try it page took 53 s; captain Bob's free -h showed swap full).

The kernel waits for the next keystroke or tick by polling, not by halting the CPU -- no hlt (x86), wfi (Arm, RISC-V) in the idle path (sk_repl_idle(), the heartbeat at 100 Hz, the v4 node's loop: to find which). Not only the demo's problem: on real hardware the same loop is a hot CPU and wasted power on every board.

Meanwhile

demo/starshipos-demo.service caps all sessions together at one core at the lowest priority (CPUQuota=100%, Nice=19).

Done when

  • The idle path halts until the next interrupt on amd64, aarch64 and riscv64 (the 100 Hz heartbeat and the console's interrupts wake it)
  • Measured: an idle guest at a few percent of a core, not 100%; the acceptance protocol passes, dict_hash unchanged
  • The demo service's cap revisited

🤖 Filed with Claude Code

### Found (2026-11-08) The demo machine (`demo/qemu-args.sh`: amd64, 384 MiB, TCG), booted to `[zuse@Hera] ok>` and left idle for 20 s: **QEMU at 100% of one host core** the whole time (148 MiB resident). With two Try-it visitors at once the server's two busy cores starved both wikis and Gitea (the .com's Try it page took 53 s; captain Bob's `free -h` showed swap full). The kernel waits for the next keystroke or tick by polling, not by halting the CPU -- no `hlt` (x86), `wfi` (Arm, RISC-V) in the idle path (`sk_repl_idle()`, the heartbeat at 100 Hz, the v4 node's loop: to find which). Not only the demo's problem: on real hardware the same loop is a hot CPU and wasted power on every board. ### Meanwhile `demo/starshipos-demo.service` caps all sessions together at one core at the lowest priority (`CPUQuota=100%`, `Nice=19`). ### Done when - [ ] The idle path halts until the next interrupt on amd64, aarch64 and riscv64 (the 100 Hz heartbeat and the console's interrupts wake it) - [ ] Measured: an idle guest at a few percent of a core, not 100%; the acceptance protocol passes, `dict_hash` unchanged - [ ] The demo service's cap revisited 🤖 Filed with [Claude Code](https://claude.com/claude-code)
rajames added this to the v4.0.0-alpha.4 milestone 2026-11-08 00:38:40 +00:00
rajames added the
status
backlog
kind
bug
priority
must
area/kernel
labels 2026-11-08 00:38:40 +00:00
Sign in to join this conversation.