public void TakeProcesses(Process[] Processes)
        {
            List<int> numbers = new List<int>();
            List<string> names = new List<string>();
            float average = 0;

            Console.WriteLine("Longest Time In Ready Queue");
            for (int i = 0; i < Processes.Length; i++)
            {
                names.Add(Processes[i].Name);
                numbers.Add(Processes[i].LongestTimeInRQ);
                average += Processes[i].LongestTimeInRQ;
            }
            average = (average / Processes.Length);
            Console.WriteLine("Average Longest Time: " + average.ToString());
            CreateGraph(numbers,names);

            average = 0;

            Console.WriteLine("Shortest Time In Ready Queue");
            numbers.RemoveRange(0, numbers.Count);
            for (int i = 0; i < Processes.Length; i++)
            {
                numbers.Add(Processes[i].SmallestTimeInRQ);
                average += Processes[i].SmallestTimeInRQ;
            }
            average = (average / Processes.Length);
            Console.WriteLine("Average Smallest Time: " + average.ToString());
            CreateGraph(numbers,names);

            average = 0;

            Console.WriteLine("Total Time In Ready Queue");
            numbers.RemoveRange(0, numbers.Count);
            for (int i = 0; i < Processes.Length; i++)
            {
                numbers.Add(Processes[i].TotalTImeInRQ);
                average += Processes[i].TotalTImeInRQ;
            }
            average = (average / Processes.Length);
            Console.WriteLine("Average RQ Time: " + average.ToString());
            CreateGraph(numbers,names);
        }
        public void Insertion(Process temp)
        {
            int numbers;

            //do a stable insert of the processs
            for (numbers = 0; numbers < Processes.Count; numbers++)
            {
                if (Processes[numbers].CurrentPriority < temp.CurrentPriority)
                {
                    Processes.Insert(numbers, temp);
                    numbers = int.MaxValue - 1;
                }
            }

            //it is actually the smallest so put it at the end
            if (numbers < 1000)
            {
                Processes.Add(temp);
            }
        }
        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();
        }
 public void InsertProcesses(Process CPU, Process Eql, Process IO)
 {
     IncomingProcesses.Add(CPU);
     IncomingProcesses.Add(Eql);
     IncomingProcesses.Add(IO);
 }