Beispiel #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;
    }