Scheduler
roundRobinDiscipline.cpp
Go to the documentation of this file.
1 
10 #include "roundRobinDiscipline.h"
11 
12 #include <cassert>
13 #include <iostream>
14 
15 
16 #include <scheduler/queue.h>
17 
18 using namespace Scheduler;
19 
20 
21 std::shared_ptr<Process> RoundRobinDiscipline::selectNextTask(Queue *readyQueue, std::shared_ptr<Process> running, unsigned int)
22 {
23  if (readyQueue->isEmpty())
24  {
25  return running;
26  }
27  return (*readyQueue->begin());
28 }
29 
30 
31 
33 {
34  return "Round Robin";
35 }
36 
37 
39 {
40  return trigger == schedTimeOut;
41 }
42 
43 
44 
45 
TriggeringEvent
Definition: eventType.h:16
This class implements the ready queue and the wait queue. Those queues contain processes ready to run...
Definition: queue.h:28
std::shared_ptr< Process > selectNextTask(Queue *readyQueue, std::shared_ptr< Process > running, unsigned int)
select the best task to run at this point.
iterator begin()
Definition: queue.cpp:65
std::string getName()
returns the name of that discipline
bool preempts(TriggeringEvent trigger)
returns true if the argument is a scheduling trigger for this specific discipline ...
bool isEmpty() const
Definition: queue.cpp:80