Ejemplo n.º 1
0
        private static void Main()
        {
            var        processStore = ProcessParser.StringToList(File.ReadAllText("Process.txt"));
            RoundRobin rr           = new RoundRobin(processStore.QuantumTime);

            foreach (IProcess t in processStore.Processes)
            {
                rr.Enqueue(t);
            }

            Console.WriteLine(rr);
            rr.Run();
            Console.WriteLine(rr.Chart);
            Console.WriteLine(rr.TotalRunTime);

            End();
        }
Ejemplo n.º 2
0
        private static void pain()
        {
            IProcess p1 = new ProcessControlBlock {
                ArrivalTime = 5, BurstTime = 25, Name = "Process A"
            };
            IProcess p2 = new ProcessControlBlock {
                ArrivalTime = 1, BurstTime = 53, Name = "Process B"
            };
            IProcess p3 = new ProcessControlBlock {
                ArrivalTime = 3, BurstTime = 27, Name = "Process C"
            };
            IProcess p4 = new ProcessControlBlock {
                ArrivalTime = 4, BurstTime = 12, Name = "Process D"
            };
            IProcess p5 = new ProcessControlBlock {
                ArrivalTime = 2, BurstTime = 69, Name = "Process E"
            };

            /*
             #region FCFS
             * Console.WriteLine("# FCFS");
             * var fcfs = new FcfsQueue();
             * fcfs.Enqueue(p1);
             * fcfs.Enqueue(p2);
             * fcfs.Enqueue(p3);
             * fcfs.Enqueue(p4);
             * fcfs.Enqueue(p5);
             *
             * Console.WriteLine(fcfs);
             * fcfs.Order();
             * Console.WriteLine(fcfs);
             *
             * fcfs.Run();
             * Console.WriteLine(fcfs.Chart);
             * Console.WriteLine(fcfs.TotalRunTime);
             #endregion
             *
             #region SJF
             * Console.WriteLine("# SJF");
             * var sjf = new SjfQueue();
             * sjf.Enqueue(p1);
             * sjf.Enqueue(p2);
             * sjf.Enqueue(p3);
             * sjf.Enqueue(p4);
             * sjf.Enqueue(p5);
             *
             * Console.WriteLine(sjf);
             * sjf.Order();
             * Console.WriteLine(sjf);
             *
             * sjf.Run();
             * Console.WriteLine(sjf.Chart);
             * Console.WriteLine(sjf.TotalRunTime);
             #endregion
             */

            #region Round Robin

            Console.WriteLine("# RR");
            var rr = new RoundRobin(10);
            rr.Enqueue(p1);
            rr.Enqueue(p2);
            rr.Enqueue(p3);
            rr.Enqueue(p4);
            rr.Enqueue(p5);

            Console.WriteLine(rr);

            rr.Run();
            Console.WriteLine(rr.Chart);
            Console.WriteLine(rr.TotalRunTime);

            #endregion

            End();
        }