RoundRobinScheduler

Struct RoundRobinScheduler 

Source
pub struct RoundRobinScheduler { /* private fields */ }
Expand description

Lock-free round-robin scheduler.

This scheduler maintains per-CPU run queues using lock-free ring buffers. Threads are scheduled in round-robin fashion with priority-based time slicing. Load balancing occurs when CPUs become idle or overloaded.

Implementations§

Source§

impl RoundRobinScheduler

Source

pub fn new(num_cpus: usize) -> Self

Create a new round-robin scheduler for the given number of CPUs.

Trait Implementations§

Source§

impl Scheduler for RoundRobinScheduler

Source§

fn enqueue(&self, thread: ReadyRef)

Enqueue a thread that is ready to run. Read more
Source§

fn pick_next(&self, cpu_id: CpuId) -> Option<ReadyRef>

Pick the next thread to run on the given CPU. Read more
Source§

fn on_tick(&self, current: &RunningRef) -> Option<ReadyRef>

Handle a scheduler tick for the currently running thread. Read more
Source§

fn set_priority(&self, thread_id: ThreadId, priority: u8)

Set the priority of a thread. Read more
Source§

fn on_yield(&self, current: RunningRef)

Handle a thread yielding the CPU voluntarily. Read more
Source§

fn on_block(&self, current: RunningRef)

Handle a thread blocking (going to sleep). Read more
Source§

fn wake_up(&self, thread: ReadyRef)

Wake up a blocked thread. Read more
Source§

fn stats(&self) -> (usize, usize, usize)

Get scheduler statistics. Read more
Source§

impl Send for RoundRobinScheduler

Source§

impl Sync for RoundRobinScheduler

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.