contur2
Loading...
Searching...
No Matches
round_robin_policy.h
Go to the documentation of this file.
1
3
4#pragma once
5
6#include <cstddef>
7
9
10namespace contur {
11
17 {
18 public:
21 explicit RoundRobinPolicy(std::size_t timeSlice);
22
24 [[nodiscard]] std::string_view name() const noexcept override;
25
27 [[nodiscard]] ProcessId selectNext(
28 const std::vector<std::reference_wrapper<const PCB>> &readyQueue, const IClock &clock
29 ) const override;
30
32 [[nodiscard]] bool shouldPreempt(const PCB &running, const PCB &candidate, const IClock &clock) const override;
33
35 [[nodiscard]] std::size_t timeSlice() const noexcept;
36
37 private:
38 std::size_t timeSlice_;
39 };
40
41} // 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
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 the next process in round-robin queue order.
std::size_t timeSlice() const noexcept
Configured time slice.
RoundRobinPolicy(std::size_t timeSlice)
Constructs Round Robin policy.
bool shouldPreempt(const PCB &running, const PCB &candidate, const IClock &clock) const override
Returns true if running process exhausted its slice.
ISchedulingPolicy interface for pluggable scheduling algorithms.
Definition block.h:15
std::uint32_t ProcessId
Unique identifier for a process.
Definition types.h:12