#include "Kernel.h" Kernel::Kernel(const List &free_pages, const List &busy_pages) : free_pages(free_pages), busy_pages(busy_pages) { } void Kernel::page_fault(PageTable page_table, const int idx) { PhysicalPage *page; if (!this->free_pages.is_empty()) { page = free_pages.last(); free_pages.remove(page); busy_pages.insert_tail(page); } else { page = nullptr; // TODO: page replacement algorithm } if (page) { page_table[idx].PPN = page->PPN; page_table[idx].P = true; page_table[idx].R = false; page_table[idx].M = false; } } void Kernel::stat_update() { for (int i = 0; i < 10; ++i) { // TODO: update busy page stats } }