-
Notifications
You must be signed in to change notification settings - Fork 0
/
Pager.h
35 lines (33 loc) · 902 Bytes
/
Pager.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
#pragma once
#include <iostream>
#include <vector>
#include <fstream>
#include "FrameTable.h"
#include "Proc.h"
using namespace std;
enum RepAlgo {fifo, randomAlgo, lru};
class Pager
{
FILE *pRandomFile;
int machineSize;
int pageSize;
int processSize;
int jobMix;
int numRefPerProc;
RepAlgo repAlgo;
bool debugFlag;
bool showRandom;
int time;
FrameTable frameTable;
std::vector<Proc> procs;
bool isAllFinish();
bool isProcFinish(int procNum){return this->procs.at(procNum).isFinish();};
FrameTableValue replacement(RepAlgo repAlgo, int* envictedFrame); //return proc number which is enviect
public:
Pager(int machineSize, int pageSize, int processSize, int jobMix, int numRefPerProc, RepAlgo repAlgo, bool debugFlag, bool showRandom);
~Pager(void);
void paging();
//static int getRandomNum();
void summarizeHead();
void summarizedTail();
};