Scheduler
Public Member Functions | Public Attributes | List of all members
Scheduler::TaskScheduler Class Reference

#include <taskScheduler.h>

Public Member Functions

 TaskScheduler (std::shared_ptr< SchedulerConfiguration > conf)
 
 ~TaskScheduler ()
 
void scheduleTask (TriggeringEvent trigger)
 This function is the scheduler. When called, it schedule the task to be executed on the processor amaong the tasks in the ready queue. The actual algorithm that selects the best task is found in the SchedulingDiscipline class. More...
 
void clearRunningTask (std::shared_ptr< Process > p)
 
void dealWithMissedDeadlines (std::shared_ptr< Process > p)
 to be called when a deadline mis event happends. This function will terminate the task and update the performance counter. More...
 
void end (std::string reportsFolder)
 cleanup and print reports More...
 
void scheduleEndOfBurst (std::shared_ptr< Process > runningTask)
 
void putRunningTaskBackToReadyQueue (std::shared_ptr< Process > task)
 
void setDiscipline (std::unique_ptr< SchedulingDiscipline > discipline)
 
void printDeadlineMissesReport (std::string folder)
 
void printReports (std::string folder)
 
void printStatus ()
 
void printRunningProcess (std::shared_ptr< Process > runningTask)
 
void printInvocation ()
 
void setBurstEnd (std::shared_ptr< Event > e)
 
std::shared_ptr< EventgetBurstEnd ()
 

Public Attributes

std::unique_ptr< SchedulingDisciplinediscipline
 
std::shared_ptr< ProcessrunningTask {nullptr}
 
std::shared_ptr< EventburstEnd
 
unsigned int deadlineMisses {0}
 
Utils::Record deadlinesHistory
 
double previousTime {0.0}
 
std::shared_ptr< SchedulerConfigurationconf
 

Detailed Description

Definition at line 31 of file taskScheduler.h.

Constructor & Destructor Documentation

TaskScheduler::TaskScheduler ( std::shared_ptr< SchedulerConfiguration conf)

Definition at line 35 of file taskScheduler.cpp.

TaskScheduler::~TaskScheduler ( )

Definition at line 41 of file taskScheduler.cpp.

Member Function Documentation

void TaskScheduler::clearRunningTask ( std::shared_ptr< Process p)

Definition at line 128 of file taskScheduler.cpp.

void TaskScheduler::dealWithMissedDeadlines ( std::shared_ptr< Process p)

to be called when a deadline mis event happends. This function will terminate the task and update the performance counter.

Parameters
pthe task that missed its deadline

Definition at line 105 of file taskScheduler.cpp.

void TaskScheduler::end ( std::string  reportsFolder)

cleanup and print reports

Definition at line 260 of file taskScheduler.cpp.

std::shared_ptr< Event > TaskScheduler::getBurstEnd ( )

Definition at line 182 of file taskScheduler.cpp.

void TaskScheduler::printDeadlineMissesReport ( std::string  folder)

Definition at line 245 of file taskScheduler.cpp.

void TaskScheduler::printInvocation ( )

Definition at line 190 of file taskScheduler.cpp.

void TaskScheduler::printReports ( std::string  folder)

Definition at line 239 of file taskScheduler.cpp.

void TaskScheduler::printRunningProcess ( std::shared_ptr< Process runningTask)

Definition at line 200 of file taskScheduler.cpp.

void TaskScheduler::printStatus ( )

Definition at line 252 of file taskScheduler.cpp.

void TaskScheduler::putRunningTaskBackToReadyQueue ( std::shared_ptr< Process task)

Definition at line 159 of file taskScheduler.cpp.

void TaskScheduler::scheduleEndOfBurst ( std::shared_ptr< Process runningTask)

Definition at line 136 of file taskScheduler.cpp.

void TaskScheduler::scheduleTask ( TriggeringEvent  trigger)

This function is the scheduler. When called, it schedule the task to be executed on the processor amaong the tasks in the ready queue. The actual algorithm that selects the best task is found in the SchedulingDiscipline class.

Parameters
triggerthe kind of event that triggered the scheduler invocation. This is needed to let the discipline know if it should act on the event, or skip it. This is bad design. I should rather make use of polymorphism. However I haven't found a better way to implement it so that a) the events stay independent from the discipline, and b) the disciplines stay easy to code, and don't have to be updated if a new event is added. The Visitor pattern, the Acyclic Visitor pattern and the Observer pattern all failed to provide a solution.

Definition at line 45 of file taskScheduler.cpp.

void TaskScheduler::setBurstEnd ( std::shared_ptr< Event e)

Definition at line 177 of file taskScheduler.cpp.

void TaskScheduler::setDiscipline ( std::unique_ptr< SchedulingDiscipline discipline)

Definition at line 224 of file taskScheduler.cpp.

Member Data Documentation

std::shared_ptr<Event> Scheduler::TaskScheduler::burstEnd

Definition at line 75 of file taskScheduler.h.

std::shared_ptr<SchedulerConfiguration> Scheduler::TaskScheduler::conf

Definition at line 82 of file taskScheduler.h.

unsigned int Scheduler::TaskScheduler::deadlineMisses {0}

Definition at line 78 of file taskScheduler.h.

Utils::Record Scheduler::TaskScheduler::deadlinesHistory

Definition at line 79 of file taskScheduler.h.

std::unique_ptr<SchedulingDiscipline> Scheduler::TaskScheduler::discipline

Definition at line 72 of file taskScheduler.h.

double Scheduler::TaskScheduler::previousTime {0.0}

Definition at line 81 of file taskScheduler.h.

std::shared_ptr<Process> Scheduler::TaskScheduler::runningTask {nullptr}

Definition at line 74 of file taskScheduler.h.


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