Initial commit

This commit is contained in:
jslightham
2023-05-21 23:28:11 -04:00
commit 0360e7dfcc
31 changed files with 2068 additions and 0 deletions

30
P2/VirtualMemory.h Normal file
View File

@@ -0,0 +1,30 @@
#ifndef VIRTUALMEMORY_H
#define VIRTUALMEMORY_H
#include "Process.h"
#include "HashTable.h"
class VirtualMemory
{
public:
VirtualMemory(int n, int p, bool chaining);
~VirtualMemory();
bool Insert(unsigned int PID);
int Search(unsigned int PID);
bool Write(unsigned int PID, int addr, int x);
void Read(unsigned int PID, int addr);
bool Delete(unsigned int PID);
void Print(int m);
private:
HashTable *ht;
int memorySize;
int pageSize;
int *memory;
std::vector<int> freeMemory;
bool chaining;
};
#endif