public bool ShouldPreempt(Processor processor, ProcessingSystem system) { if (processor.CurrentlyRunningProcess == null) { return(false); } var currentProcessPid = processor.CurrentlyRunningProcess.ProcessId; return(currentProcessPid == _currentRunningPid && _runningStreak >= TimeQuantum); }
/// <summary> /// As the FIFO policy is non-preemptive, this always returns false. /// </summary> /// <param name="processor">The processor that uses this policy.</param> /// <param name="system">The system of the processor.</param> /// <returns>False.</returns> public bool ShouldPreempt(Processor processor, ProcessingSystem system) { return(false); }
public bool ShouldPreempt(Processor processor, ProcessingSystem system) { return(processor.CurrentlyRunningProcess != null && processor.LocalQueue.Any(process => process.CyclesRemaining < processor.CurrentlyRunningProcess.CyclesRemaining)); }