コード例 #1
0
        /*-----------<gives a call to createprocess method and enques the processes in the ready queue>-----------*/

        public int spawnCall(string number)
        {
            Console.Title           = "Mother Builder";
            Console.BackgroundColor = ConsoleColor.White;
            Console.ForegroundColor = ConsoleColor.DarkBlue;
            Console.Write("\n  Demo Parent Process");
            Console.Write("\n =====================");
            count  = Int32.Parse(number);
            sender = new Sender[count + 1];

            int process_id = 0;



            for (int i = 1; i <= count; i = i + 1)
            {
                process_id = process_id + 1;
                if (SpawnProc.createProcess(process_id, mainport + i))
                {
                    readyqueue.enQ(process_id);
                    sender[i] = new Sender(baseAddress, mainport + i);
                    Console.Write(" - succeeded");
                }
                else
                {
                    Console.Write(" - failed");
                }
            }
            return(count);
        }
コード例 #2
0
        public static void Main(string[] args)
        {
            if (args.Count() > 0)
            {
                SpawnProc sproc = new SpawnProc();
                Console.WriteLine("\n Mother Builder is running on 8080 port \n");

                sproc.receiveMessages();               //continuously check for ready processes and input them into a readyqueue
                sproc.spawnCall(args[0]);              //spawn the processes
                sproc.checkBuildQueue();               //continously check build queue for assigning processes with the build req
            }
        }