contur2
Loading...
Searching...
No Matches
priority_policy.h
Go to the documentation of this file.
1
3
4#pragma once
5
7
8namespace contur {
9
14 class PriorityPolicy final : public ISchedulingPolicy
15 {
16 public:
18 [[nodiscard]] std::string_view name() const noexcept override;
19
21 [[nodiscard]] ProcessId selectNext(
22 const std::vector<std::reference_wrapper<const PCB>> &readyQueue, const IClock &clock
23 ) const override;
24
26 [[nodiscard]] bool shouldPreempt(const PCB &running, const PCB &candidate, const IClock &clock) const override;
27 };
28
29} // namespace contur
Abstract clock interface for simulation time.
Definition clock.h:21
Strategy interface for scheduling algorithms.
Process Control Block — stores all metadata for a single process.
Definition pcb.h:55
Dynamic-priority scheduling policy.
std::string_view name() const noexcept override
Policy name.
bool shouldPreempt(const PCB &running, const PCB &candidate, const IClock &clock) const override
Preempts when candidate priority outranks running process.
ProcessId selectNext(const std::vector< std::reference_wrapper< const PCB > > &readyQueue, const IClock &clock) const override
Selects process with highest effective priority.
ISchedulingPolicy interface for pluggable scheduling algorithms.
Definition block.h:15
std::uint32_t ProcessId
Unique identifier for a process.
Definition types.h:12