⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

Module sched

Module sched 

Source
Expand description

Process and thread scheduling module

Implements a multi-level scheduler with support for:

  • Multiple scheduling algorithms (round-robin, priority, CFS)
  • Real-time scheduling classes
  • SMP load balancing
  • CPU affinity
  • Context switching for x86_64, AArch64, and RISC-V

This module is a facade that re-exports the public API from submodules:

  • scheduler - Core scheduler algorithm and state
  • task - Task control block and priority types
  • metrics - Performance metrics and measurement
  • smp - Symmetric multiprocessing support
  • queue - Ready queue management
  • numa - NUMA-aware scheduling
  • [init] - Initialization and timer setup
  • runtime - Scheduler execution loop and idle task
  • process_compat - Process compatibility wrapper types
  • ipc_blocking - IPC blocking/waking and wait queues
  • task_management - Task creation, exit, and thread scheduling
  • load_balance - Load balancing and task migration

Re-exports§

pub use scheduler::SchedAlgorithm;
pub use init::init;
pub use init::init_with_bootstrap;
pub use ipc_blocking::block_on_ipc;
pub use ipc_blocking::block_process;
pub use ipc_blocking::wake_up_endpoint_waiters;
pub use ipc_blocking::wake_up_process;
pub use ipc_blocking::yield_cpu;
pub use load_balance::balance_load;
pub use load_balance::cleanup_dead_tasks;
pub use process_compat::alloc_pid;
pub use process_compat::current_process;
pub use process_compat::find_process;
pub use process_compat::switch_to_process;
pub use process_compat::TaskProcessAdapter;
pub use runtime::has_ready_tasks;
pub use runtime::idle_task_entry;
pub use runtime::run;
pub use runtime::set_algorithm;
pub use runtime::start;
pub use runtime::timer_tick;
pub use task::Priority;
pub use task::SchedClass;
pub use task::SchedPolicy;
pub use task::Task;
pub use task_management::exit_task;
pub use task_management::create_task;
pub use task_management::create_task_from_thread;
pub use task_management::schedule_thread;
pub use self::scheduler::should_preempt;

Modules§

deadline
Earliest Deadline First (EDF) Deadline Scheduler
init
Scheduler initialization and timer setup
ipc_blocking
IPC blocking and waking operations
load_balance
Load balancing and task migration between CPUs
metrics
Scheduler performance metrics and measurement
numa
NUMA-Aware Scheduling
percpu_queue
Per-CPU Ready Queues with Work-Stealing
process_compat
Process compatibility wrapper types
queue
Ready queue management for scheduler
runtime
Scheduler runtime loop and idle task management
scheduler
Core scheduler implementation
smp
Symmetric multiprocessing (SMP) support
task
Task management and task control block (TCB) implementation
task_management
Task creation, exit, and thread scheduling
task_ptr
Safe wrapper for task pointers

Functions§

current_process_id
Get the PID of the currently running task.
get_current_thread_id
Get the current thread ID from the running task.
set_current_task
Set current task (for testing)

Type Aliases§

Process
Type alias for backward compatibility.