示例#1
0
        public static void ChangePriority(string Name, string Priority)
        {
            int NewPriority = 0;

            if (!int.TryParse(Priority, out NewPriority))
            {
                Console.WriteLine("Podana wartosc nie jest liczba.");
                return;
            }

            if (NewPriority >= 0 && NewPriority <= 7)
            {
                PCB pcb = PCB.GetPCB(Name);
                if (pcb != null)
                {
                    pcb.CurrentPriority         = NewPriority;
                    pcb.StartPriority           = NewPriority;
                    pcb.WaitingForProcessorTime = 1;
                    Console.WriteLine("Ustawiono nowy priorytet (" + NewPriority + ") dla procesu " + Name + ".");
                }
            }
            else
            {
                Console.WriteLine("Priorytet procesu musi miescic sie w zakresie od 0 do 7.");
            }
        }
示例#2
0
        public static void ResumeProcess(string Name)
        {
            PCB pcb = PCB.GetPCB(Name);

            if (pcb != null)
            {
                pcb.StopWaiting();
            }
        }
示例#3
0
        public static void SleepProcess(string Name)
        {
            PCB pcb = PCB.GetPCB(Name);

            if (pcb != null)
            {
                pcb.WaitForSomething();
            }
        }
示例#4
0
        public static void ShowPCB(string Name)
        {
            PCB pcb = PCB.GetPCB(Name);

            if (pcb != null)
            {
                pcb.PrintAllFields();
            }
        }
示例#5
0
        public static void StopProcess(string Name)
        {
            PCB pcb = PCB.GetPCB(Name);

            if (pcb != null)
            {
                pcb.TerminateProcess(ReasonOfProcessTerminating.UserClosed);
            }
        }
示例#6
0
 public static void RunNewProcess(string Name)
 {
     if (Name == "-all")
     {
         PCB.RunAllNewProcesses();
     }
     else
     {
         PCB pcb = PCB.GetPCB(Name);
         if (pcb != null)
         {
             pcb.RunNewProcess();
         }
     }
 }