public void releasePage(page page, RAM ram) { page.valid = false; ram.frameList[page.frameNumber].available = true; for (int i = page.ramBaseAddress; i < page.ramBaseAddress + 128; i++) { ram.data[i] = -1; } }
public void pageLoadRam(Disk disk, page page, RAM ram) { int index = ram.getFreeFrame(); if (index == ram.frameList.Length) { return; //no available memory } page.frameNumber = index; page.ramBaseAddress = ram.frameList[index].startAddress; ram.frameList[index].available = false; int ramPointer = ram.frameList[index].startAddress; int diskPointer = page.diskBaseAddress; for (int i = 0; i < 128; i++) { ram.data[ramPointer] = disk.data[diskPointer]; ramPointer++; diskPointer++; } page.valid = true; }
public void requestPageLoad(Disk disk, RAM ram, page page) { pageLoadRam(disk, page, ram); }