Contur 2
Educational OS kernel simulator
Loading...
Searching...
No Matches
contur::ISchedulingPolicy Class Referenceabstract

Strategy interface for scheduling algorithms. More...

#include <i_scheduling_policy.h>

Inheritance diagram for contur::ISchedulingPolicy:

Public Member Functions

virtual ~ISchedulingPolicy ()=default
virtual std::string_view name () const noexcept=0
 Human-readable policy name.
virtual ProcessId selectNext (const std::vector< SchedulingProcessSnapshot > &readyQueue, const IClock &clock) const =0
 Selects the next process ID from the ready queue.
virtual bool shouldPreempt (const SchedulingProcessSnapshot &running, const SchedulingProcessSnapshot &candidate, const IClock &clock) const =0
 Decides whether the current running process should be preempted.

Detailed Description

Strategy interface for scheduling algorithms.

Definition at line 35 of file i_scheduling_policy.h.

Constructor & Destructor Documentation

◆ ~ISchedulingPolicy()

virtual contur::ISchedulingPolicy::~ISchedulingPolicy ( )
virtualdefault

Member Function Documentation

◆ name()

virtual std::string_view contur::ISchedulingPolicy::name ( ) const
nodiscardpure virtualnoexcept

◆ selectNext()

virtual ProcessId contur::ISchedulingPolicy::selectNext ( const std::vector< SchedulingProcessSnapshot > & readyQueue,
const IClock & clock ) const
nodiscardpure virtual

Selects the next process ID from the ready queue.

Parameters
readyQueueImmutable snapshot of ready processes.
clockSimulation clock.
Returns
Selected process ID, or INVALID_PID if queue is empty.

Implemented in contur::FcfsPolicy, contur::HrrnPolicy, contur::MlfqPolicy, contur::PriorityPolicy, contur::RoundRobinPolicy, contur::SpnPolicy, and contur::SrtPolicy.

References selectNext().

Referenced by selectNext().

◆ shouldPreempt()

virtual bool contur::ISchedulingPolicy::shouldPreempt ( const SchedulingProcessSnapshot & running,
const SchedulingProcessSnapshot & candidate,
const IClock & clock ) const
nodiscardpure virtual

Decides whether the current running process should be preempted.

Parameters
runningCurrently running process.
candidateCandidate ready process chosen by selectNext().
clockSimulation clock.

Implemented in contur::FcfsPolicy, contur::HrrnPolicy, contur::MlfqPolicy, contur::PriorityPolicy, contur::RoundRobinPolicy, contur::SpnPolicy, and contur::SrtPolicy.

References shouldPreempt().

Referenced by shouldPreempt().


The documentation for this class was generated from the following file: