示例#1
0
 public static void incrementwaittimes(MLFQ_Queue queue)
 {
     if (queue.queuenumber == 1)
     {
         for (int j = 0; j < queue.Count; j++)
         {
             queue.ElementAt(j).wait++;
         }
         for (int j = 0; j < queue.queue2.Count; j++)
         {
             queue.queue2.ElementAt(j).wait++;
         }
         for (int j = 0; j < queue.queue3.Count; j++)
         {
             queue.queue3.ElementAt(j).wait++;
         }
     }
     else if (queue.queuenumber == 2)
     {
         for (int j = 0; j < queue.Count; j++)
         {
             queue.ElementAt(j).wait++;
         }
         for (int j = 0; j < queue.queue1.Count; j++)
         {
             queue.queue1.ElementAt(j).wait++;
         }
         for (int j = 0; j < queue.queue3.Count; j++)
         {
             queue.queue3.ElementAt(j).wait++;
         }
     }
     else if (queue.queuenumber == 3)
     {
         for (int j = 0; j < queue.Count; j++)
         {
             queue.ElementAt(j).wait++;
         }
         for (int j = 0; j < queue.queue1.Count; j++)
         {
             queue.queue1.ElementAt(j).wait++;
         }
         for (int j = 0; j < queue.queue2.Count; j++)
         {
             queue.queue2.ElementAt(j).wait++;
         }
     }
 }
示例#2
0
        public static void printexecution(Process p, MLFQ_Queue queue1, MLFQ_Queue queue2, MLFQ_Queue queue3)
        {
            Console.WriteLine("---------------------------------------------------");
            Console.WriteLine("Execution Time is " + totaltime + "            " + p.name + " is Running");
            if (queue1.Count != 0)
            {
                for (int j = 0; j < queue1.Count; j++)
                {
                    if (queue1.ElementAt(j).data.Count != 0)
                    {
                        Console.WriteLine(queue1.ElementAt(j).name + " CPU Burst Length " + queue1.ElementAt(j).data.First() + " is inside of Queue 1" + "\n");
                    }
                }
            }
            if (queue2.Count != 0)
            {
                for (int k = 0; k < queue2.Count; k++)
                {
                    if (queue2.ElementAt(k).data.Count != 0)
                    {
                        Console.WriteLine(queue2.ElementAt(k).name + " CPU Burst Length " + queue2.ElementAt(k).data.First() + " is inside of Queue 2" + "\n");
                    }
                }
            }
            if (queue3.Count != 0)
            {
                for (int f = 0; f < queue3.Count; f++)
                {
                    if (queue3.ElementAt(f).data.Count != 0)
                    {
                        Console.WriteLine(queue3.ElementAt(f).name + " CPU Burst Length " + queue3.ElementAt(f).data.First() + " is inside of Queue 3" + "\n");
                    }
                }
            }
            int timeremaining = 0;

            Console.WriteLine("Processes in I/O\n");
            for (int y = 0; y < processesinio.Count; y++)
            {
                timeremaining = processesinio.ElementAt(y).ioburst - processesinio.ElementAt(y).iocounter;
                Console.WriteLine(processesinio.ElementAt(y).name + " Time Remaining in I/O " + timeremaining + "\n");
            }
        }