32 lines
716 B
C++
32 lines
716 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(0), busy_pages(0);
|
||
|
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));
|
||
|
}
|
||
|
|
||
|
for (const auto process : kernel.RunQ)
|
||
|
std::cout << process.executionTime << std::endl;
|
||
|
|
||
|
// std::cout << MAX_PROC << std::endl;
|
||
|
|
||
|
return 0;
|
||
|
}
|