Contur 2
Educational OS kernel simulator
Loading...
Searching...
No Matches
contur::MPDispatcher Class Referencefinal

Multiprocessor dispatcher delegating to child dispatchers. More...

#include <mp_dispatcher.h>

Inheritance diagram for contur::MPDispatcher:

Public Member Functions

 MPDispatcher (std::vector< std::reference_wrapper< IDispatcher > > dispatchers, IDispatchRuntime &runtime)
 Constructs MP dispatcher with worker dispatchers and required injected runtime strategy.
 ~MPDispatcher () override
 Destroys MP dispatcher.
 MPDispatcher (const MPDispatcher &)=delete
 Copy construction is disabled.
MPDispatcheroperator= (const MPDispatcher &)=delete
 Copy assignment is disabled.
 MPDispatcher (MPDispatcher &&) noexcept
 Move-constructs MP dispatcher state.
MPDispatcheroperator= (MPDispatcher &&) noexcept
 Move-assigns MP dispatcher state.
Result< void > createProcess (std::unique_ptr< ProcessImage > process, Tick currentTick) override
 Routes a process to one child dispatcher.
Result< void > dispatch (std::size_t tickBudget) override
 Runs dispatch cycle across all child dispatchers.
Result< void > terminateProcess (ProcessId pid, Tick currentTick) override
 Terminates process in the child dispatcher that owns it.
void tick () override
 Ticks all child dispatchers.
std::size_t processCount () const noexcept override
 Aggregated number of processes across children.
bool hasProcess (ProcessId pid) const noexcept override
 Returns true if any child contains process pid.
Public Member Functions inherited from contur::IDispatcher
virtual ~IDispatcher ()=default

Private Attributes

std::unique_ptr< Impl > impl_

Detailed Description

Multiprocessor dispatcher delegating to child dispatchers.

Definition at line 17 of file mp_dispatcher.h.

Constructor & Destructor Documentation

◆ MPDispatcher() [1/3]

contur::MPDispatcher::MPDispatcher ( std::vector< std::reference_wrapper< IDispatcher > > dispatchers,
IDispatchRuntime & runtime )

Constructs MP dispatcher with worker dispatchers and required injected runtime strategy.

Parameters
dispatchersDispatcher lanes used by the runtime.
runtimeRuntime strategy injected by composition root.

Referenced by MPDispatcher(), MPDispatcher(), operator=(), and operator=().

◆ ~MPDispatcher()

contur::MPDispatcher::~MPDispatcher ( )
override

Destroys MP dispatcher.

◆ MPDispatcher() [2/3]

contur::MPDispatcher::MPDispatcher ( const MPDispatcher & )
delete

Copy construction is disabled.

References MPDispatcher().

◆ MPDispatcher() [3/3]

contur::MPDispatcher::MPDispatcher ( MPDispatcher && )
noexcept

Move-constructs MP dispatcher state.

References MPDispatcher().

Member Function Documentation

◆ createProcess()

Result< void > contur::MPDispatcher::createProcess ( std::unique_ptr< ProcessImage > process,
Tick currentTick )
nodiscardoverridevirtual

Routes a process to one child dispatcher.

Implements contur::IDispatcher.

References createProcess().

Referenced by createProcess().

◆ dispatch()

Result< void > contur::MPDispatcher::dispatch ( std::size_t tickBudget)
nodiscardoverridevirtual

Runs dispatch cycle across all child dispatchers.

Implements contur::IDispatcher.

References dispatch().

Referenced by dispatch().

◆ hasProcess()

bool contur::MPDispatcher::hasProcess ( ProcessId pid) const
nodiscardoverridevirtualnoexcept

Returns true if any child contains process pid.

Implements contur::IDispatcher.

References hasProcess().

Referenced by hasProcess().

◆ operator=() [1/2]

MPDispatcher & contur::MPDispatcher::operator= ( const MPDispatcher & )
delete

Copy assignment is disabled.

References MPDispatcher().

◆ operator=() [2/2]

MPDispatcher & contur::MPDispatcher::operator= ( MPDispatcher && )
noexcept

Move-assigns MP dispatcher state.

References MPDispatcher().

◆ processCount()

std::size_t contur::MPDispatcher::processCount ( ) const
nodiscardoverridevirtualnoexcept

Aggregated number of processes across children.

Implements contur::IDispatcher.

References processCount().

Referenced by processCount().

◆ terminateProcess()

Result< void > contur::MPDispatcher::terminateProcess ( ProcessId pid,
Tick currentTick )
nodiscardoverridevirtual

Terminates process in the child dispatcher that owns it.

Implements contur::IDispatcher.

References terminateProcess().

Referenced by terminateProcess().

◆ tick()

void contur::MPDispatcher::tick ( )
overridevirtual

Ticks all child dispatchers.

Implements contur::IDispatcher.

References tick().

Referenced by tick().

Member Data Documentation

◆ impl_

std::unique_ptr<Impl> contur::MPDispatcher::impl_
private

Definition at line 59 of file mp_dispatcher.h.


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