Skip to main content

Module kernel

Module kernel 

Source
Expand description

The supervisor (spec 3.2 §7.2).

A Kernel composes the background machinery adk-rust serve already builds (§6 D-9) and adds a worker per queue class, the scheduler, the wake sources, the process table, the event bus and the control plane:

Kernel partBuilt from
WorkersOne DurableWorker per QueueClass, each with KernelConfig::worker_config: on_governance_refusal: Park (§10 S3), the class’s poll interval, the S1 WorkerHooks turned into KernelEvents, and the targets registered with KernelBuilder::agent (the harness runner as adk-rust and harness.goal), on KernelConfig::clock
SchedulerDurableScheduler::new(schedules, runs).with_governance(..).with_clock(..), ticking every KernelConfig::scheduler_tick on KernelConfig::clock
Wake sourcesKernelBuilder::wake_source, KernelBuilder::trigger and KernelBuilder::queue_ingress, routed by the WakeRouter (§7.4)
ApprovalsStoreApprovalService::with_run_store, so a decision wakes the parked run; the service’s tick on the kernel’s clock for expiries
Kill switchKernelConfig::governance: GovernanceControl::mirrored with a 250 ms poll on multi-replica (KernelConfig::mirrored_governance, K-I8)
Control planeControlPlane over KernelConfig::control (§7.11)
/proc (feature proc)KernelBuilder::ledger: a sink on the bus writes every event’s ledger row; the hosted runtime’s ProgressSource gets the ledger at start; with proc-baselines the maintenance tick enqueues the daily kernel.proc pass, and KernelBuilder::observation_audience puts a partition’s observations to a person as agenda questions (§7.10)

Lifecycle: pause shuts each worker’s claim loop down and lets running processes finish their attempt; drain suspends running processes at their next checkpoint through S1’s suspend path, then shuts the loops down, and on timeout aborts them so their leases lapse; stop also stops drivers and closes the control plane. A SIGTERM is drain(30 s) then stop (shutdown_on_signal). Nothing is lost on a hard kill: leases expire and another claim resumes from the checkpoint.

freeze calls GovernanceControl::freeze_recorded; parking is the worker’s (§10 S3), so every replica’s worker parks its own running processes Waiting with ParkReason::Frozen as its mirrored control observes the freeze. unfreeze calls unfreeze_recorded and wakes exactly the freeze-parked processes (K-I21). The kernel registers itself as the GovernanceController’s FreezeDelegate (§10 S4), so POST /api/admin/freeze parks.

Structs§

Kernel
The resident supervisor (spec 3.2 §7.2). Cloning shares the kernel.
KernelBuilder
Builds a Kernel (spec 3.2 §7.2).
KernelConfig
How the kernel runs (spec 3.2 §7.2).
KernelHealth
The kernel’s health (spec 3.2 §7.2): per worker, scheduler lag and store latency.
RunNow
What Kernel::run_now queued.
Steering
A message a running process holds for its agent’s next safe point (spec 3.3 §6 “steer”): what Kernel::steer answers.
WorkerHealth
One worker’s health (spec 3.2 §7.2).

Enums§

KernelState
Where the kernel is in its lifecycle (spec 3.2 §7.2).
RunNowTarget
What Kernel::run_now runs now.