contur2
Loading...
Searching...
No Matches
contur::MlfqPolicy Class Referencefinal

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

#include <mlfq_policy.h>

Inheritance diagram for contur::MlfqPolicy:
Collaboration 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< std::reference_wrapper< const PCB > > &readyQueue, const IClock &clock) const override
 Selects next process according to MLFQ level ordering.
bool shouldPreempt (const PCB &running, const PCB &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).

Member Function Documentation

◆ levelTimeSlices()

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

Configured level time slices.

◆ name()

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

Policy name.

Implements contur::ISchedulingPolicy.

◆ selectNext()

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

Selects next process according to MLFQ level ordering.

Implements contur::ISchedulingPolicy.

◆ shouldPreempt()

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

Returns true when running process should be preempted.

Implements contur::ISchedulingPolicy.

Member Data Documentation

◆ levelTimeSlices_

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

Definition at line 39 of file mlfq_policy.h.


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