예제 #1
0
        public void terminateProcess(Process t_process)
        {
            t_process.finishing_cycle = clock_value;
            t_process.time_in_system = t_process.finishing_cycle - t_process.arrival_cycle;
            t_process.idle_time = t_process.time_in_system - t_process.total_io1 - t_process.total_cpu;
            t_process.status = "Killed";

            updatePCB(t_process, t_process.getID());

            last_finished = t_process.id;

            Finished.addProcess(t_process);
            finished_list.Text += t_process.getID() + "\r\n";
        }
예제 #2
0
 public void updatePCB(Process n_process, string id)
 {
     ListViewItem lvi = pcb.FindItemWithText(id);
     string[] process = n_process.getValues(clock_value);
     if (lvi != null)
     {
         for (int i = 1; i < 11; i++)
             lvi.SubItems[i].Text = process[i];
     }
     else
     {
         var n = new ListViewItem(process);
         pcb.Items.Add(n);
     }
 }
예제 #3
0
        public void generateProcess()
        {
            Process n_process;
            if(rand.Next(0,100) < chance)
            {
                //public Process(int next_id, int cycle, int avrg, Random rand, int q, int iouse, int iochance, int frame_size)
                n_process = new Process(last_processid + 1, clock_value, average_cycles, rand, tquantum, io1_usage, io1_chance, frame_s);
                last_processid++;
                New.addProcess(n_process);

                new_list.AppendText(n_process.getID() + "\r\n");
                updatePCB(n_process, n_process.getID());
            }
        }