Scheduler
fcfsDiscipline.cpp
Go to the documentation of this file.
1 
10 #include "fcfsDiscipline.h"
11 
12 #include <cassert>
13 #include <iostream>
14 
15 #include <scheduler/queue.h>
16 
17 using namespace Scheduler;
18 
19 std::shared_ptr<Process> FcfsDiscipline::selectNextTask(Queue *readyQueue, std::shared_ptr<Process> running, unsigned int)
20 {
21  if (readyQueue->isEmpty())
22  {
23  assert(running == nullptr);
24  return running; /*For a fcfs, this should be nullptr*/
25  }
26  return (*readyQueue->begin());
27 }
28 
29 
31 {
32  return "FCFS";
33 }
34 
36 {
37  return false;
38 }
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
bool preempts(TriggeringEvent trigger)
returns true if the argument is a scheduling trigger for this specific discipline ...
iterator begin()
Definition: queue.cpp:65
std::shared_ptr< Process > selectNextTask(Queue *readyQueue, std::shared_ptr< Process > running, unsigned int deadlineMisses) override
select the best task to run at this point.
std::string getName()
returns the name of that discipline
bool isEmpty() const
Definition: queue.cpp:80