-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRateMonotonic.h
38 lines (31 loc) · 1.04 KB
/
RateMonotonic.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* @file RateMonotonic.h
* @brief Contains the rate monotonic class definitions
*
* Contains the definition of the rate monotonic class and the node struct.
* Uses 4 threads using "Queues" to simulate a rate monotonic scheduler.
*
* @date 10/31/24
* @author Fiya Clerget, Marcello Novak
*/
#pragma once
#include "Queue.h"
#include "SchedulerCommon.h"
#include "Task.h"
#include <vector>
#include <iostream>
using namespace std;
class RateMonotonicScheduler {
protected:
vector<Thread> threads; // Stores each thread with its queue, frequency, and ID
vector<int> nextReleaseTimes; // Tracks the next release time for each thread
void addTask(int priority);
void incrementTopTask(int priority);
public:
enum class ExampleType { STRUCTURED, STARVED };
// Constructor and Destructor
RateMonotonicScheduler(ExampleType exampleType);
~RateMonotonicScheduler();
// Functions to run the examples
void runExample();
};