|
contur2
|
Optimal page replacement (Belady's algorithm). More...
#include <optimal_replacement.h>


Public Member Functions | |
| OptimalReplacement (std::vector< FrameId > futureAccesses) | |
| Constructs with a known future access sequence. | |
| ~OptimalReplacement () override | |
| OptimalReplacement (const OptimalReplacement &)=delete | |
| OptimalReplacement & | operator= (const OptimalReplacement &)=delete |
| OptimalReplacement (OptimalReplacement &&) noexcept | |
| OptimalReplacement & | operator= (OptimalReplacement &&) noexcept |
| std::string_view | name () const noexcept override |
| Returns the name of the algorithm (e.g., "FIFO", "LRU"). | |
| FrameId | selectVictim (const PageTable &pageTable) override |
| Selects a victim frame to evict. | |
| void | onAccess (FrameId frame) override |
| Notifies the policy that a frame was accessed (read or write). | |
| void | onLoad (FrameId frame) override |
| Notifies the policy that a new page was loaded into a frame. | |
| void | reset () override |
| Resets the policy's internal state. | |
| Public Member Functions inherited from contur::IPageReplacementPolicy | |
| virtual | ~IPageReplacementPolicy ()=default |
Private Attributes | |
| std::unique_ptr< Impl > | impl_ |
Optimal page replacement (Belady's algorithm).
Evicts the page that will not be used for the longest time in the future. Requires the complete future access sequence to be known in advance. This is impractical for real systems but serves as a theoretical baseline for comparing other algorithms' performance.
Definition at line 19 of file optimal_replacement.h.
|
explicit |
Constructs with a known future access sequence.
| futureAccesses | Ordered list of FrameIds that will be accessed. |
|
override |
|
delete |
|
noexcept |
|
nodiscardoverridevirtualnoexcept |
Returns the name of the algorithm (e.g., "FIFO", "LRU").
Implements contur::IPageReplacementPolicy.
|
overridevirtual |
Notifies the policy that a frame was accessed (read or write).
Implements contur::IPageReplacementPolicy.
|
overridevirtual |
Notifies the policy that a new page was loaded into a frame.
Implements contur::IPageReplacementPolicy.
|
delete |
|
noexcept |
|
overridevirtual |
Resets the policy's internal state.
Implements contur::IPageReplacementPolicy.
|
nodiscardoverridevirtual |
Selects a victim frame to evict.
| pageTable | The current page table state. |
Implements contur::IPageReplacementPolicy.
|
private |
Definition at line 40 of file optimal_replacement.h.