Skip to content
Snippets Groups Projects
  • Florian Fischer's avatar
    24993175
    introduce new Scheduler::scheduleOn(fiber, workerId) function · 24993175
    Florian Fischer authored
    This function is needed to deal with worker local ressources: io_uring
    requests for example.
    
    Each worker now always has a MPSC inbox queue which was already used
    in the laws scheduling strategy.
    Fibers can be scheduled to a specific worker using the new
    Scheduler::scheduleOn method.
    
    Since the inbox queues are now always present we can use a single
    FiberSource enum combining AbstractWorkStealingStrategy::FiberSource
    and LawsStrategy::FiberSource.
    
    The laws strategy now uses the inbox queues as its priority queues.
    With the only differenze that when scheduling to a inbox queue
    using the Scheduler::scheduleOn the Fiber lifes only in the inbox
    queue and not also simultaneously in a WSQ.
    
    Unrelated code changes made while touching the code anyway:
    * Introduce FiberSource::io which hints that a Fiber comes from the
      worker's own CQ.
    * Strongly type the fiber's source in NextFiberResult.
    * Make all scheduler functions return std::optional<NextFiberResult>
    * Cleanup the identation in nextFiberResultViaWorkStealing
    24993175
    History
    introduce new Scheduler::scheduleOn(fiber, workerId) function
    Florian Fischer authored
    This function is needed to deal with worker local ressources: io_uring
    requests for example.
    
    Each worker now always has a MPSC inbox queue which was already used
    in the laws scheduling strategy.
    Fibers can be scheduled to a specific worker using the new
    Scheduler::scheduleOn method.
    
    Since the inbox queues are now always present we can use a single
    FiberSource enum combining AbstractWorkStealingStrategy::FiberSource
    and LawsStrategy::FiberSource.
    
    The laws strategy now uses the inbox queues as its priority queues.
    With the only differenze that when scheduling to a inbox queue
    using the Scheduler::scheduleOn the Fiber lifes only in the inbox
    queue and not also simultaneously in a WSQ.
    
    Unrelated code changes made while touching the code anyway:
    * Introduce FiberSource::io which hints that a Fiber comes from the
      worker's own CQ.
    * Strongly type the fiber's source in NextFiberResult.
    * Make all scheduler functions return std::optional<NextFiberResult>
    * Cleanup the identation in nextFiberResultViaWorkStealing