Ejemplo n.º 1
0
    public void Run()
    {
        while (ActiveProcess.Status == ComputerStatus.Running || ActiveProcess.Status == ComputerStatus.Waiting ||
               WaitingProcesses.Keys.ToList().Any())
        {
            if (ActiveProcess.Status == ComputerStatus.Running)
            {
                ActiveProcess.Start();
            }
            else if (ActiveProcess.Status == ComputerStatus.Waiting)
            {
                SetSharedMemory(ActiveProcess.DumpOutput());
                WaitingProcesses.Add(ActiveProcess.WaitingSince, ActiveProcess.Identifier);
                ActiveProcess = GetLongestWaitingProcess();
                ActiveProcess.setInput(GetSharedMemory(ActiveProcess.Identifier));
            }
            else
            {
                SetSharedMemory(ActiveProcess.DumpOutput());
                ActiveProcess = GetLongestWaitingProcess();
                ActiveProcess.setInput(GetSharedMemory(ActiveProcess.Identifier));
            }
        }

        LastOutput = ActiveProcess.DumpOutput().Item1;
    }
Ejemplo n.º 2
0
 public void QueueProcess(IProcess process)
 {
     process.Status = ComputerStatus.Waiting;
     AllProcesses.Add(process.Identifier, process);
     WaitingProcesses.Add(DateTime.Now, process.Identifier);
 }