Exemplo n.º 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.");
            }
        }
Exemplo n.º 2
0
        public static void ResumeProcess(string Name)
        {
            PCB pcb = PCB.GetPCB(Name);

            if (pcb != null)
            {
                pcb.StopWaiting();
            }
        }
Exemplo n.º 3
0
        public static void SleepProcess(string Name)
        {
            PCB pcb = PCB.GetPCB(Name);

            if (pcb != null)
            {
                pcb.WaitForSomething();
            }
        }
Exemplo n.º 4
0
        public static void ShowPCB(string Name)
        {
            PCB pcb = PCB.GetPCB(Name);

            if (pcb != null)
            {
                pcb.PrintAllFields();
            }
        }
Exemplo n.º 5
0
        public static void StopProcess(string Name)
        {
            PCB pcb = PCB.GetPCB(Name);

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