Contur 2
Educational OS kernel simulator
Loading...
Searching...
No Matches
clock_replacement.h
Go to the documentation of this file.
1
3
4#pragma once
5
6#include <memory>
7
9
10namespace contur {
11
18 {
19 public:
22
25
28
33
35 ClockReplacement &operator=(ClockReplacement &&) noexcept;
36
38 [[nodiscard]] std::string_view name() const noexcept override;
39
41 [[nodiscard]] FrameId selectVictim(const PageTable &pageTable) override;
42
44 void onAccess(FrameId frame) override;
45
47 void onLoad(FrameId frame) override;
48
50 void reset() override;
51
52 private:
53 struct Impl;
54 std::unique_ptr<Impl> impl_;
55 };
56
57} // namespace contur
std::string_view name() const noexcept override
Returns the name of the algorithm (e.g., "FIFO", "LRU").
ClockReplacement(ClockReplacement &&) noexcept
Move-constructs policy state.
FrameId selectVictim(const PageTable &pageTable) override
Selects a victim frame to evict.
ClockReplacement()
Creates a clock replacement policy with empty tracking state.
ClockReplacement & operator=(const ClockReplacement &)=delete
Copy assignment is disabled.
void onAccess(FrameId frame) override
Notifies the policy that a frame was accessed (read or write).
void reset() override
Resets the policy's internal state.
std::unique_ptr< Impl > impl_
void onLoad(FrameId frame) override
Notifies the policy that a new page was loaded into a frame.
~ClockReplacement() override
Destroys clock replacement policy.
ClockReplacement(const ClockReplacement &)=delete
Copy construction is disabled.
Abstract interface for page replacement algorithms.
Page table mapping virtual page numbers to physical frames.
Definition page_table.h:27
IPageReplacementPolicy interface — pluggable page replacement algorithms.
Definition block.h:15
std::uint32_t FrameId
Frame number in physical memory.
Definition types.h:43