contur2
Loading...
Searching...
No Matches
contur::IPageReplacementPolicy Class Referenceabstract

Abstract interface for page replacement algorithms. More...

#include <i_page_replacement.h>

Inheritance diagram for contur::IPageReplacementPolicy:

Public Member Functions

virtual ~IPageReplacementPolicy ()=default
virtual std::string_view name () const noexcept=0
 Returns the name of the algorithm (e.g., "FIFO", "LRU").
virtual FrameId selectVictim (const PageTable &pageTable)=0
 Selects a victim frame to evict.
virtual void onAccess (FrameId frame)=0
 Notifies the policy that a frame was accessed (read or write).
virtual void onLoad (FrameId frame)=0
 Notifies the policy that a new page was loaded into a frame.
virtual void reset ()=0
 Resets the policy's internal state.

Detailed Description

Abstract interface for page replacement algorithms.

The MMU consults this policy to decide which physical frame to evict when a page fault occurs and no free frames are available. Implementations: FIFO, LRU, Clock, Optimal.

Definition at line 19 of file i_page_replacement.h.

Constructor & Destructor Documentation

◆ ~IPageReplacementPolicy()

virtual contur::IPageReplacementPolicy::~IPageReplacementPolicy ( )
virtualdefault

Member Function Documentation

◆ name()

virtual std::string_view contur::IPageReplacementPolicy::name ( ) const
nodiscardpure virtualnoexcept

Returns the name of the algorithm (e.g., "FIFO", "LRU").

Implemented in contur::ClockReplacement, contur::FifoReplacement, contur::LruReplacement, and contur::OptimalReplacement.

◆ onAccess()

virtual void contur::IPageReplacementPolicy::onAccess ( FrameId frame)
pure virtual

Notifies the policy that a frame was accessed (read or write).

Implemented in contur::ClockReplacement, contur::FifoReplacement, contur::LruReplacement, and contur::OptimalReplacement.

◆ onLoad()

virtual void contur::IPageReplacementPolicy::onLoad ( FrameId frame)
pure virtual

Notifies the policy that a new page was loaded into a frame.

Implemented in contur::ClockReplacement, contur::FifoReplacement, contur::LruReplacement, and contur::OptimalReplacement.

◆ reset()

virtual void contur::IPageReplacementPolicy::reset ( )
pure virtual

Resets the policy's internal state.

Implemented in contur::ClockReplacement, contur::FifoReplacement, contur::LruReplacement, and contur::OptimalReplacement.

◆ selectVictim()

virtual FrameId contur::IPageReplacementPolicy::selectVictim ( const PageTable & pageTable)
nodiscardpure virtual

Selects a victim frame to evict.

Parameters
pageTableThe current page table state.
Returns
The FrameId of the frame to evict.

Implemented in contur::ClockReplacement, contur::FifoReplacement, contur::LruReplacement, and contur::OptimalReplacement.


The documentation for this class was generated from the following file: