pub struct ZernelScheduler {
config: SchedulerConfig,
phase_detector: PhaseDetector,
task_states: HashMap<u32, ZernelTaskState>,
numa: NumaTopology,
tenant_scheduler: TenantScheduler,
cpu_loads: HashMap<u32, f32>,
pub decisions_made: u64,
}Expand description
The Zernel ML-aware scheduler.
Integrates phase detection, NUMA-aware CPU selection, and multi-tenant GPU-proportional scheduling.
Fields§
§config: SchedulerConfig§phase_detector: PhaseDetector§task_states: HashMap<u32, ZernelTaskState>§numa: NumaTopology§tenant_scheduler: TenantScheduler§cpu_loads: HashMap<u32, f32>Per-CPU load estimates (cpu_id -> load fraction 0.0-1.0).
decisions_made: u64Total scheduling decisions made.
Implementations§
Source§impl ZernelScheduler
impl ZernelScheduler
pub fn new(config: SchedulerConfig) -> Self
Sourcepub fn register_task(&mut self, pid: u32, is_ml: bool, gpu_id: Option<u32>)
pub fn register_task(&mut self, pid: u32, is_ml: bool, gpu_id: Option<u32>)
Register a new task for tracking.
Sourcepub fn unregister_task(&mut self, pid: u32)
pub fn unregister_task(&mut self, pid: u32)
Remove a task from tracking.
Sourcepub fn update_task(&mut self, pid: u32, update: TaskUpdate)
pub fn update_task(&mut self, pid: u32, update: TaskUpdate)
Update task metrics (called from BPF ringbuf events or polling).
Sourcepub fn update_cpu_loads(&mut self, loads: HashMap<u32, f32>)
pub fn update_cpu_loads(&mut self, loads: HashMap<u32, f32>)
Update CPU load estimates (called periodically from /proc/stat or BPF).
Sourcepub fn schedule(&mut self, pid: u32, now_ns: u64) -> SchedulingDecision
pub fn schedule(&mut self, pid: u32, now_ns: u64) -> SchedulingDecision
Run phase detection and return a scheduling decision for a task.
Sourcepub fn tenant_scheduler_mut(&mut self) -> &mut TenantScheduler
pub fn tenant_scheduler_mut(&mut self) -> &mut TenantScheduler
Get a reference to the tenant scheduler.
Sourcepub fn task_states(&self) -> &HashMap<u32, ZernelTaskState>
pub fn task_states(&self) -> &HashMap<u32, ZernelTaskState>
Get current state snapshot for telemetry export.
pub fn numa_topology(&self) -> &NumaTopology
pub fn phase_transition_count(&self) -> u64
pub fn config(&self) -> &SchedulerConfig
Auto Trait Implementations§
impl Freeze for ZernelScheduler
impl RefUnwindSafe for ZernelScheduler
impl Send for ZernelScheduler
impl Sync for ZernelScheduler
impl Unpin for ZernelScheduler
impl UnwindSafe for ZernelScheduler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more