//реализуем алгоритм планирования //SJF с вытеснением по оставшемуся времени //подумать по оставшемуся времени ,это по берст тайм public void Next_Step() { if (!cpu.Free() && cpu.active_process.Ended()) { cpu.active_process.End(); cpu.stop_pr(); cpu.act_pr = null; cpu.busy_pr = false; } if (cpu.Free() && piramida.C() != 0 && piramida.Count() != 0)//!piramida.Empty()) { cpu.start_pr(piramida.Item()); piramida.Remove_max(); } if (!cpu.Free() && piramida.C() != 0 && piramida.Count() != 0) { if (cpu.active_process.CompareTo(piramida.Item()) == 1) { // cpu.active_process.End(); Process p = cpu.active_process; cpu.start_pr(piramida.Item()); piramida.Remove_max(); piramida.Put(p); } } }
private void button2_Click(object sender, EventArgs e) { if (q.Count() == 0) { MessageBox.Show("Элементов больше нет"); // q = new Piramida<int>(); q = new Piramida <int>(); } try { q.Remove_max(); listBox1.Items.Clear(); for (int i = 0; i < q.Count(); i++) { listBox1.Items.Add(q.GetQ[i]); } } catch { label2.Text = Convert.ToString(0); } }