spz3/main.cpp

36 lines
750 B
C++

#include <iostream>
#include <random>
#include "Kernel.h"
static int MAX_PROC = 10;
static int PAGE_N = 10;
int main() {
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<unsigned int> distribution(0, 10);
List<PhysicalPage> free_pages, busy_pages;
Kernel kernel(free_pages, busy_pages);
for (int i = 0; i < PAGE_N; ++i) {
free_pages.insert_tail(new PhysicalPage(i));
}
for (int i = 0; i < MAX_PROC; ++i) {
kernel.RunQ.emplace_back(nullptr, distribution(gen));
}
while (!kernel.RunQ.empty()) {
}
for (const auto process : kernel.RunQ)
std::cout << process.executionTime << std::endl;
std::cout << MAX_PROC << std::endl;
return 0;
}