コード例 #1
0
        public static void GenerateProcesses(ScheduleClass Temp)
        {
            int i;
            Process CPU;
            Process Eql;
            Process IO;
            Random rand = new Random();
            for (i = 0; i <= 15; i++)
            {
                CPU = new Process();
                Eql = new Process();
                IO = new Process();

                CPU.Name = "CPU" + i.ToString();
                Eql.Name = "Equal" + i.ToString();
                IO.Name = "IO" + i.ToString();

                CPU.CurrentPriority = CPU.StartingPriority = i;
                Eql.CurrentPriority = Eql.StartingPriority = i;
                IO.CurrentPriority = IO.StartingPriority = i;

                CPU.TimeNeededInCPU = rand.Next(5, 8);
                CPU.TimeNeededInIO = rand.Next(3,4);

                Eql.TimeNeededInCPU = rand.Next(3,5);
                Eql.TimeNeededInIO = rand.Next(3,5);

                IO.TimeNeededInCPU = rand.Next(3,4);
                IO.TimeNeededInIO = rand.Next(5,8);

                CPU.TotalCyclesNeeded = rand.Next(4,6);
                IO.TotalCyclesNeeded = rand.Next(4, 6);
                Eql.TotalCyclesNeeded = rand.Next(4,6);

                Temp.InsertProcesses(CPU, Eql, IO);
            }

            Temp.SortLists();
        }