Files
LithosAnanake/Kconfig.heartbeat

81 lines
3.5 KiB
Plaintext

menu "Heartbeat / adaptive tick coordinator"
config HEARTBEAT_THREAD_ENABLED
bool "Run vm_tick() in a background thread (HEARTBEAT_THREAD_ENABLED)"
depends on STARFORTH_VARIANT_HOSTED
default y
help
y = OPTIMAL: vm_tick() runs in a dedicated background thread.
n = legacy inline tick, driven from the main interpreter loop.
Kernel-build resolution (Phase 4 of the Kconfig migration, the
phase's named verification target): `depends on
STARFORTH_VARIANT_HOSTED` above means this symbol is invisible for
a kernel-variant config -- CONFIG_HEARTBEAT_THREAD_ENABLED simply
never appears in a kernel .config/auto.conf, so
mk/Kconfig.mk's kconfig_bool bridge resolves it to 0 for kernel
builds without needing a special case. This is UI/model
correctness (menuconfig can't offer a choice LithosAnanke has no
way to honor -- there are no pthreads in a freestanding kernel),
not the sole enforcement mechanism: Makefile.starkernel additionally
keeps its own unconditional `VM_FEATURE_OVERRIDES +=
-DHEARTBEAT_THREAD_ENABLED=0` post-override exactly as it was
before this migration. Deliberately redundant with the `depends
on` above -- the Kconfig model documents *why* the kernel can't
offer this choice, the Makefile-level override *guarantees* the
kernel never ships with a threaded heartbeat even if the Kconfig
tree, a hand-edited auto.conf, or a future refactor ever
disagrees. Belt-and-suspenders on purpose: the failure mode this
guards against (a freestanding kernel image linking against
pthreads that don't exist) is silent-until-boot and expensive to
debug on real hardware, not the kind of thing to trust to a single
layer.
config HEARTBEAT_TICK_NS
int "Heartbeat thread wake period, nanoseconds (HEARTBEAT_TICK_NS)"
depends on HEARTBEAT_THREAD_ENABLED
default 10000
help
Background heartbeat thread wake frequency (default 10000ns = 1ms).
Only meaningful when HEARTBEAT_THREAD_ENABLED is on.
config HEARTBEAT_CHECK_FREQUENCY
int "Word-execution gate for a tick, executions (HEARTBEAT_CHECK_FREQUENCY)"
default 256
help
vm_tick() is gated by executed-word count, not just wall time --
this is how many word executions must occur between heartbeat
checks. This is also, note well, the same counter that makes
vm->heartbeat.tick_count a purely execution-driven virtual clock
(see docs/working/architecture/VM-FLEET-ATTRACTOR-DESIGN-20260705.md,
rev t) -- the value Loop #3 heat decay reads instead of real
nanoseconds, to keep dict_hash architecture-invariant.
config HEARTBEAT_WINDOW_TUNING_FREQUENCY
int "Rolling window width re-tune interval, ticks (HEARTBEAT_WINDOW_TUNING_FREQUENCY)"
default 1000
help
How many heartbeat ticks between Loop #5 (window width inference)
runs.
config HEARTBEAT_SLOPE_VALIDATION_FREQUENCY
int "Decay slope re-validation interval, ticks (HEARTBEAT_SLOPE_VALIDATION_FREQUENCY)"
default 5000
help
How many heartbeat ticks between Loop #6 (decay slope inference)
revalidation runs.
config EMERGENCY_CONSOLE_ENABLED
bool "Interactive fault handler / error-recovery REPL (EMERGENCY_CONSOLE_ENABLED)"
default y
help
y = REPL recovers from errors and continues (interactive
fallthrough surface). Set to n for production, embedded, or
high-security builds where an error should not hand control back
to an interactive console. Applies to both the hosted VM and the
kernel build; the kernel's emergency_console VM flag additionally
applies only to the bare `ok>` REPL -- zuse sessions are always
subject to ACL regardless of this setting.
endmenu