-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtilities.h
More file actions
executable file
·39 lines (36 loc) · 1 KB
/
Utilities.h
File metadata and controls
executable file
·39 lines (36 loc) · 1 KB
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
class Counter{//class gia counter
int page_faults;
int write_backs;
public:
Counter():page_faults(0),write_backs(0){};
void page_fault(){page_faults++;};
void write_back(){write_backs++;};
int get_pf(){return page_faults;};
int get_wb(){return write_backs;};
};
class Inv_PT{
int n;//arithmos thesewn pinaka
int *pid;//pinakas pou krataei pid
int *page;//pinakas pou krataei selides
bool *dirty;//pinakas gia dirty
bool *victim;//pinakas gia victim
Counter *count;//metrhths
public:
Inv_PT(int,Counter*);//constructor
void Insert(int pid_arg,int page_arg,bool dirty_bit); //Inserts page at the first victim frame,true if victim was dirty,false otherwise
void Dirt(int pid_arg,int page_arg);
void Victimize(int pid_arg); //Victimize every page from proc
void Print_Test();
~Inv_PT();
};
class FWF_stack{
int pid;
int n;
int current;
int *pages;
Inv_PT *ipt;
public:
FWF_stack(int pid_arg,int n_arg,Inv_PT *ipt_arg);
~FWF_stack();
void New_Trace(int page,bool dirty);
};