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."); } }
public static void ResumeProcess(string Name) { PCB pcb = PCB.GetPCB(Name); if (pcb != null) { pcb.StopWaiting(); } }
public static void SleepProcess(string Name) { PCB pcb = PCB.GetPCB(Name); if (pcb != null) { pcb.WaitForSomething(); } }
public static void ShowPCB(string Name) { PCB pcb = PCB.GetPCB(Name); if (pcb != null) { pcb.PrintAllFields(); } }
public static void StopProcess(string Name) { PCB pcb = PCB.GetPCB(Name); if (pcb != null) { pcb.TerminateProcess(ReasonOfProcessTerminating.UserClosed); } }
public static void RunNewProcess(string Name) { if (Name == "-all") { PCB.RunAllNewProcesses(); } else { PCB pcb = PCB.GetPCB(Name); if (pcb != null) { pcb.RunNewProcess(); } } }