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

Scheduler host that manages process queues and policy decisions. More...

#include <scheduler.h>

Inheritance diagram for contur::Scheduler:
Collaboration diagram for contur::Scheduler:

Public Member Functions

 Scheduler (std::unique_ptr< ISchedulingPolicy > policy)
 Constructs scheduler with initial policy.
 ~Scheduler () override
 Scheduler (const Scheduler &)=delete
Scheduleroperator= (const Scheduler &)=delete
 Scheduler (Scheduler &&) noexcept
Scheduleroperator= (Scheduler &&) noexcept
Result< void > enqueue (PCB &pcb, Tick currentTick) override
 Enqueues process into ready queue.
Result< void > dequeue (ProcessId pid) override
 Removes process from scheduler tracking.
Result< ProcessIdselectNext (const IClock &clock) override
 Selects next process according to active policy.
Result< void > blockRunning (Tick currentTick) override
 Moves running process to blocked state.
Result< void > unblock (ProcessId pid, Tick currentTick) override
 Moves blocked process back to ready queue.
Result< void > terminate (ProcessId pid, Tick currentTick) override
 Terminates process and removes it from scheduler state.
std::vector< ProcessIdgetQueueSnapshot () const override
 Snapshot of ready queue process IDs.
std::vector< ProcessIdgetBlockedSnapshot () const override
 Snapshot of blocked queue process IDs.
ProcessId runningProcess () const noexcept override
 Currently running process ID or INVALID_PID.
Result< void > setPolicy (std::unique_ptr< ISchedulingPolicy > policy) override
 Replaces the active scheduling policy.
std::string_view policyName () const noexcept
 Returns active policy name.
Public Member Functions inherited from contur::IScheduler
virtual ~IScheduler ()=default

Private Attributes

std::unique_ptr< Impl > impl_

Detailed Description

Scheduler host that manages process queues and policy decisions.

Scheduler owns queue state and delegates ordering/preemption logic to the active ISchedulingPolicy implementation.

Definition at line 16 of file scheduler.h.

Constructor & Destructor Documentation

◆ Scheduler() [1/3]

contur::Scheduler::Scheduler ( std::unique_ptr< ISchedulingPolicy > policy)
explicit

Constructs scheduler with initial policy.

Parameters
policyNon-null scheduling policy implementation.

◆ ~Scheduler()

contur::Scheduler::~Scheduler ( )
override

◆ Scheduler() [2/3]

contur::Scheduler::Scheduler ( const Scheduler & )
delete

◆ Scheduler() [3/3]

contur::Scheduler::Scheduler ( Scheduler && )
noexcept

Member Function Documentation

◆ blockRunning()

Result< void > contur::Scheduler::blockRunning ( Tick currentTick)
nodiscardoverridevirtual

Moves running process to blocked state.

Implements contur::IScheduler.

◆ dequeue()

Result< void > contur::Scheduler::dequeue ( ProcessId pid)
nodiscardoverridevirtual

Removes process from scheduler tracking.

Implements contur::IScheduler.

◆ enqueue()

Result< void > contur::Scheduler::enqueue ( PCB & pcb,
Tick currentTick )
nodiscardoverridevirtual

Enqueues process into ready queue.

Implements contur::IScheduler.

◆ getBlockedSnapshot()

std::vector< ProcessId > contur::Scheduler::getBlockedSnapshot ( ) const
nodiscardoverridevirtual

Snapshot of blocked queue process IDs.

Implements contur::IScheduler.

◆ getQueueSnapshot()

std::vector< ProcessId > contur::Scheduler::getQueueSnapshot ( ) const
nodiscardoverridevirtual

Snapshot of ready queue process IDs.

Implements contur::IScheduler.

◆ operator=() [1/2]

Scheduler & contur::Scheduler::operator= ( const Scheduler & )
delete

◆ operator=() [2/2]

Scheduler & contur::Scheduler::operator= ( Scheduler && )
noexcept

◆ policyName()

std::string_view contur::Scheduler::policyName ( ) const
nodiscardnoexcept

Returns active policy name.

◆ runningProcess()

ProcessId contur::Scheduler::runningProcess ( ) const
nodiscardoverridevirtualnoexcept

Currently running process ID or INVALID_PID.

Implements contur::IScheduler.

◆ selectNext()

Result< ProcessId > contur::Scheduler::selectNext ( const IClock & clock)
nodiscardoverridevirtual

Selects next process according to active policy.

Implements contur::IScheduler.

◆ setPolicy()

Result< void > contur::Scheduler::setPolicy ( std::unique_ptr< ISchedulingPolicy > policy)
nodiscardoverridevirtual

Replaces the active scheduling policy.

Implements contur::IScheduler.

◆ terminate()

Result< void > contur::Scheduler::terminate ( ProcessId pid,
Tick currentTick )
nodiscardoverridevirtual

Terminates process and removes it from scheduler state.

Implements contur::IScheduler.

◆ unblock()

Result< void > contur::Scheduler::unblock ( ProcessId pid,
Tick currentTick )
nodiscardoverridevirtual

Moves blocked process back to ready queue.

Implements contur::IScheduler.

Member Data Documentation

◆ impl_

std::unique_ptr<Impl> contur::Scheduler::impl_
private

Definition at line 64 of file scheduler.h.


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