-
Notifications
You must be signed in to change notification settings - Fork 0
/
CPU.h
54 lines (38 loc) · 733 Bytes
/
CPU.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef CPU_H
#define CPU_H
#include <queue>
#include <vector>
#include <pthread.h>
#include <semaphore.h>
#include "task.h"
#include "CFS_RQ.h"
using namespace std;
class CPU
{
public:
CPU(void*, long long int);
// PUSHER
void rbt_queue_push(TASK&);
int size();
int number;
bool busy;
pthread_mutex_t sync_mutex;
vector<TASK> task_list();
private:
CFS_RQ cfs_rq;
TASK running;
queue <TASK> rbt_queue;
sem_t rbt_queue_sem;
pthread_mutex_t rbt_queue_mutex;
long long int time_delta;
void* idleq;
// THREAD FUNCTIONS
static void* tick_fair(void*);
static void* pusher(void*);
// PUSHER
TASK rbt_queue_pop();
bool rbt_queue_empty();
void rbt_queue_lock();
void rbt_queue_unlock();
};
#endif