Пример #1
0
        static void Main(string[] args)
        {
            //drawScreen();
            PCB testingPCB = new PCB(10, 1);

            testingPCB.funcion  = f1;
            testingPCB.quadrant = 1;
            //currentPCB = testingPCB;


            PCB otroPCB = new PCB(5, 1);

            otroPCB.quadrant = 2;
            otroPCB.funcion  = idle;

            int          i     = 0;
            ProcessAdmin admin = new ProcessAdmin();



            //admin.listener();
            //currentPCB = admin.getCurrentRunningProcess()
            currentPCB = admin.getRunningPCB();
            currentPCB.activate();
            while (true)
            {
                try
                {
                    Thread input = new Thread(() => admin.getInput());
                    //Console.WriteLine(currentPCB.idproc);
                    chooseFunc(currentPCB);


                    currentPCB.funcion();
                    sm.drawScreen();
                    input.Start();



                    //Task screen = new Task(() => sm.drawScreen());
                    //screen.Start();

                    //thread.IsBackground = true;
                    //sm.drawScreen();
                    //Thread t2 = new Thread(() => admin.getInput());
                    //t2.Start();
                    //admin.getInput();
                    currentPCB = admin.getRunningPCB();
                }
                catch (System.ArgumentException)
                {
                }
                System.Threading.Thread.Sleep(3 * 1000);

                /*
                 * int height = Console.WindowHeight;
                 * int width = Console.WindowWidth;
                 *
                 * //Console.WriteLine("Height: " + height + "\nWidth: " + width);
                 *
                 *
                 *
                 * i++;
                 *
                 *
                 * //Console.WriteLine("AreaHeight: " + areaHeights + "\nAreaWidth: " + areaWidths);
                 *
                 * // jumb between areas
                 * if(i % 4 == 0)
                 * {
                 *  idle(4);
                 * }
                 * else if(i % 3 == 0)
                 * {
                 *  sm.AddLineToBuffer(ref sm.area3, i.ToString());
                 * }
                 * else if(i % 2 == 0)
                 * {
                 *  sm.AddLineToBuffer(ref sm.area2, i.ToString());
                 * }
                 * else
                 * {
                 *  sm.AddLineToBuffer(ref sm.area1, i.ToString());
                 * }
                 */

                //admin.getInput(); // getting options from user afterwards: verify received input.
            }
        }
Пример #2
0
        //Initiliaze all kernel threads
        public void startProgram()
        {
            ProcessAdmin pa = new ProcessAdmin();

            io = new Thread(new ThreadStart(pa.getInput));
        }