Contur 2
Educational OS kernel simulator
Loading...
Searching...
No Matches
contur::RoundRobinPolicy Class Referencefinal

Round Robin scheduling policy. More...

#include <round_robin_policy.h>

Inheritance diagram for contur::RoundRobinPolicy:

Public Member Functions

 RoundRobinPolicy (std::size_t timeSlice)
 Constructs Round Robin policy.
std::string_view name () const noexcept override
 Policy name.
ProcessId selectNext (const std::vector< SchedulingProcessSnapshot > &readyQueue, const IClock &clock) const override
 Selects the next process in round-robin queue order.
bool shouldPreempt (const SchedulingProcessSnapshot &running, const SchedulingProcessSnapshot &candidate, const IClock &clock) const override
 Returns true if running process exhausted its slice.
std::size_t timeSlice () const noexcept
 Configured time slice.
Public Member Functions inherited from contur::ISchedulingPolicy
virtual ~ISchedulingPolicy ()=default

Private Attributes

std::size_t timeSlice_

Detailed Description

Round Robin scheduling policy.

Uses fixed-size time slices and preempts when the running process consumes its configured budget.

Definition at line 16 of file round_robin_policy.h.

Constructor & Destructor Documentation

◆ RoundRobinPolicy()

contur::RoundRobinPolicy::RoundRobinPolicy ( std::size_t timeSlice)
explicit

Constructs Round Robin policy.

Parameters
timeSliceMaximum ticks a process can run before preemption.

References timeSlice().

Member Function Documentation

◆ name()

std::string_view contur::RoundRobinPolicy::name ( ) const
nodiscardoverridevirtualnoexcept

Policy name.

Implements contur::ISchedulingPolicy.

◆ selectNext()

ProcessId contur::RoundRobinPolicy::selectNext ( const std::vector< SchedulingProcessSnapshot > & readyQueue,
const IClock & clock ) const
nodiscardoverridevirtual

Selects the next process in round-robin queue order.

Implements contur::ISchedulingPolicy.

References selectNext().

Referenced by selectNext().

◆ shouldPreempt()

bool contur::RoundRobinPolicy::shouldPreempt ( const SchedulingProcessSnapshot & running,
const SchedulingProcessSnapshot & candidate,
const IClock & clock ) const
nodiscardoverridevirtual

Returns true if running process exhausted its slice.

Implements contur::ISchedulingPolicy.

References shouldPreempt().

Referenced by shouldPreempt().

◆ timeSlice()

std::size_t contur::RoundRobinPolicy::timeSlice ( ) const
nodiscardnoexcept

Configured time slice.

References timeSlice().

Referenced by RoundRobinPolicy(), and timeSlice().

Member Data Documentation

◆ timeSlice_

std::size_t contur::RoundRobinPolicy::timeSlice_
private

Definition at line 39 of file round_robin_policy.h.


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