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

Multilevel Feedback Queue (MLFQ) scheduling policy. More...

#include <mlfq_policy.h>

Inheritance diagram for contur::MlfqPolicy:

Public Member Functions

 MlfqPolicy (std::vector< std::size_t > levelTimeSlices={1, 2, 4})
 Constructs MLFQ policy.
std::string_view name () const noexcept override
 Policy name.
ProcessId selectNext (const std::vector< SchedulingProcessSnapshot > &readyQueue, const IClock &clock) const override
 Selects next process according to MLFQ level ordering.
bool shouldPreempt (const SchedulingProcessSnapshot &running, const SchedulingProcessSnapshot &candidate, const IClock &clock) const override
 Returns true when running process should be preempted.
const std::vector< std::size_t > & levelTimeSlices () const noexcept
 Configured level time slices.
Public Member Functions inherited from contur::ISchedulingPolicy
virtual ~ISchedulingPolicy ()=default

Private Attributes

std::vector< std::size_t > levelTimeSlices_

Detailed Description

Multilevel Feedback Queue (MLFQ) scheduling policy.

Classifies processes across multiple priority levels with distinct time slices and adapts scheduling behavior from runtime feedback.

Definition at line 17 of file mlfq_policy.h.

Constructor & Destructor Documentation

◆ MlfqPolicy()

contur::MlfqPolicy::MlfqPolicy ( std::vector< std::size_t > levelTimeSlices = {1, 2, 4})
explicit

Constructs MLFQ policy.

Parameters
levelTimeSlicesTime slice per level (highest to lowest).

References levelTimeSlices().

Member Function Documentation

◆ levelTimeSlices()

const std::vector< std::size_t > & contur::MlfqPolicy::levelTimeSlices ( ) const
nodiscardnoexcept

Configured level time slices.

References levelTimeSlices().

Referenced by levelTimeSlices(), and MlfqPolicy().

◆ name()

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

Policy name.

Implements contur::ISchedulingPolicy.

◆ selectNext()

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

Selects next process according to MLFQ level ordering.

Implements contur::ISchedulingPolicy.

References selectNext().

Referenced by selectNext().

◆ shouldPreempt()

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

Returns true when running process should be preempted.

Implements contur::ISchedulingPolicy.

References shouldPreempt().

Referenced by shouldPreempt().

Member Data Documentation

◆ levelTimeSlices_

std::vector<std::size_t> contur::MlfqPolicy::levelTimeSlices_
private

Definition at line 40 of file mlfq_policy.h.


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