Scheduler
taskScheduler.h
Go to the documentation of this file.
1 
10 #ifndef TASKSCHEDULER_H
11 #define TASKSCHEDULER_H
12 
13 #include <memory>
14 
15 #include <utils/record.h>
16 
17 #include "events/eventList.h"
18 #include "events/eventType.h"
19 
20 namespace Scheduler
21 {
22 
23 class Event;
24 class FreqGovernor;
25 class Process;
26 class Queue;
27 class SchedulerConfiguration;
28 class SchedulingDiscipline;
29 class TemperatureModel;
30 
32 {
33 public:
34  TaskScheduler(std::shared_ptr<SchedulerConfiguration> conf);
47  void scheduleTask(TriggeringEvent trigger);
51  void clearRunningTask(std::shared_ptr<Process> p);
56  void dealWithMissedDeadlines(std::shared_ptr<Process> p);
59  void end(std::string reportsFolder);
60 
61 
62 //those should be private but public for test purposes atm
63  void scheduleEndOfBurst(std::shared_ptr<Process> runningTask);
64  void putRunningTaskBackToReadyQueue(std::shared_ptr<Process> task);
65  void setDiscipline(std::unique_ptr<SchedulingDiscipline> discipline);
66  void printDeadlineMissesReport(std::string folder);
67  void printReports(std::string folder);
68  void printStatus();
69  void printRunningProcess(std::shared_ptr<Process> runningTask);
70  void printInvocation();
71 
72  std::unique_ptr<SchedulingDiscipline> discipline;
73 
74  std::shared_ptr<Process> runningTask{nullptr};
75  std::shared_ptr<Event> burstEnd;
76  void setBurstEnd(std::shared_ptr<Event> e);
77  std::shared_ptr<Event> getBurstEnd();
78  unsigned int deadlineMisses{0};
80 
81  double previousTime{0.0};
82  std::shared_ptr<SchedulerConfiguration> conf;
83 
84 };
85 
86 }
87 
88 #endif
void printReports(std::string folder)
TriggeringEvent
Definition: eventType.h:16
TaskScheduler(std::shared_ptr< SchedulerConfiguration > conf)
void putRunningTaskBackToReadyQueue(std::shared_ptr< Process > task)
void end(std::string reportsFolder)
cleanup and print reports
std::shared_ptr< Event > burstEnd
Definition: taskScheduler.h:75
void printRunningProcess(std::shared_ptr< Process > runningTask)
void setBurstEnd(std::shared_ptr< Event > e)
void setDiscipline(std::unique_ptr< SchedulingDiscipline > discipline)
unsigned int deadlineMisses
Definition: taskScheduler.h:78
void scheduleTask(TriggeringEvent trigger)
This function is the scheduler. When called, it schedule the task to be executed on the processor ama...
std::shared_ptr< Process > runningTask
Definition: taskScheduler.h:74
std::shared_ptr< SchedulerConfiguration > conf
Definition: taskScheduler.h:82
void clearRunningTask(std::shared_ptr< Process > p)
void scheduleEndOfBurst(std::shared_ptr< Process > runningTask)
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...
std::shared_ptr< Event > getBurstEnd()
Utils::Record deadlinesHistory
Definition: taskScheduler.h:79
std::unique_ptr< SchedulingDiscipline > discipline
Definition: taskScheduler.h:72
void printDeadlineMissesReport(std::string folder)