Exemplo n.º 1
0
 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;
     }
 }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
0
 public void requestPageLoad(Disk disk, RAM ram, page page)
 {
     pageLoadRam(disk, page, ram);
 }