contur2
Loading...
Searching...
No Matches
i_scheduling_policy.h
Go to the documentation of this file.
1
3
4#pragma once
5
6#include <functional>
7#include <string_view>
8#include <vector>
9
10#include "contur/core/types.h"
11
12namespace contur {
13
14 class IClock;
15 class PCB;
16
19 {
20 public:
21 virtual ~ISchedulingPolicy() = default;
22
24 [[nodiscard]] virtual std::string_view name() const noexcept = 0;
25
30 [[nodiscard]] virtual ProcessId
31 selectNext(const std::vector<std::reference_wrapper<const PCB>> &readyQueue, const IClock &clock) const = 0;
32
37 [[nodiscard]] virtual bool
38 shouldPreempt(const PCB &running, const PCB &candidate, const IClock &clock) const = 0;
39 };
40
41} // namespace contur
Abstract clock interface for simulation time.
Definition clock.h:21
Strategy interface for scheduling algorithms.
virtual ~ISchedulingPolicy()=default
virtual bool shouldPreempt(const PCB &running, const PCB &candidate, const IClock &clock) const =0
Decides whether the current running process should be preempted.
virtual ProcessId selectNext(const std::vector< std::reference_wrapper< const PCB > > &readyQueue, const IClock &clock) const =0
Selects the next process ID from the ready queue.
virtual std::string_view name() const noexcept=0
Human-readable policy name.
Process Control Block — stores all metadata for a single process.
Definition pcb.h:55
Definition block.h:15
std::uint32_t ProcessId
Unique identifier for a process.
Definition types.h:12
Common type aliases, sentinel constants, and forward declarations used throughout the Contur 2 kernel...