2025-03-31 17:19:43 +03:00
|
|
|
#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);
|
|
|
|
|
2025-03-31 22:20:01 +03:00
|
|
|
List<PhysicalPage> free_pages, busy_pages;
|
2025-03-31 17:19:43 +03:00
|
|
|
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));
|
|
|
|
}
|
|
|
|
|
2025-03-31 22:20:01 +03:00
|
|
|
while (!kernel.RunQ.empty()) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2025-03-31 17:19:43 +03:00
|
|
|
for (const auto process : kernel.RunQ)
|
|
|
|
std::cout << process.executionTime << std::endl;
|
|
|
|
|
2025-03-31 22:20:01 +03:00
|
|
|
std::cout << MAX_PROC << std::endl;
|
2025-03-31 17:19:43 +03:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|