private void timer_Tick(object sender, EventArgs e) { //se tiver espaço na memoria para o primeiro processo da memoria virtual if (!VirtualMemory.Empyt()) { if (!Memory.MemoryFull(VirtualMemory.FirstLenght())) { Memory.InitializeProcess(VirtualMemory.KillProcess()); } } }
public static void InitializeProcess(Process MyProcess) { if (MyProcess.Size + Length <= Capacity) { Length += MyProcess.Size; cont++; Ram.Enqueue(MyProcess); } else { VirtualMemory.InitializeProcess(MyProcess); } }
private void Button13_Click(object sender, EventArgs e) { Process p = new Process(); p.Name = "Photoshop"; p.Size = 40; p.Time = 15; if (Memory.MemoryFull(p.Size)) { VirtualMemory.InitializeProcess(p); } else { Memory.InitializeProcess(p); } RefreshData(); }
private void Button11_Click(object sender, EventArgs e) { Process p = new Process(); p.Name = "Bloco de Notas"; p.Size = 8; p.Time = 4; if (Memory.MemoryFull(p.Size)) { VirtualMemory.InitializeProcess(p); } else { Memory.InitializeProcess(p); } RefreshData(); }
private void button6_Click(object sender, EventArgs e) { Process p = new Process(); p.Name = "Power Point"; p.Size = 16; p.Time = 6; if (Memory.MemoryFull(p.Size)) { VirtualMemory.InitializeProcess(p); } else { Memory.InitializeProcess(p); } RefreshData(); }
private void button5_Click(object sender, EventArgs e) { Process p = new Process(); p.Name = "Excel"; p.Size = 10; p.Time = 4; if (Memory.MemoryFull(p.Size)) { VirtualMemory.InitializeProcess(p); } else { Memory.InitializeProcess(p); } RefreshData(); }
private void button4_Click(object sender, EventArgs e) { Process p = new Process(); p.Name = "Visual Studio"; p.Size = 50; p.Time = 20; if (Memory.MemoryFull(p.Size)) { VirtualMemory.InitializeProcess(p); } else { Memory.InitializeProcess(p); } RefreshData(); }