Open Thomasdezeeuw opened 5 years ago
Possible data structure for the scheduler http://wtarreau.blogspot.com/2011/12/elastic-binary-trees-ebtree.html.
First step to change the scheduler would be defining an interface with operations needed for the scheduling to determine where the focus of performance should be.
The required API as a trait would look something like the following
trait Scheduler {
/// Returns true if the scheduler has any processes.
fn has_process(&self) -> bool;
/// Returns true is there are any processes ready to run, i.e. active.
fn has_active_process(&self) -> bool;
/// Run the next active process.
///
/// Returns `true` if a process was run, `false` otherwise.
fn run_process(&mut self, system_ref: &mut ActorSystemRef) -> bool;
/// Add a new process
// See old scheduler for `AddingProcess`.
fn add_process<'a>(&'a mut self) -> AddingProcess<'a>;
}
// Maybe a separate type for scheduling so it can be used from our `task::Waker`
// implementation and `ActorSystemRef::schedule`.
trait Schedule {
fn schedule(&mut self, pid: ProcessId);
}
The current scheduler is very simple and such receive some more attention. The same goes for the polling to process running ratio in the actor system.