public bool AddProcess(Process process)
    {
        if (_repository.GetSize() >= _maxSize)
        {
            var lowestPriority = _repository.GetAllSortedByPriority().FirstOrDefault();
            if (process.Priority > lowestPriority.Priority)
            {
                _repository.Remove(lowestPriority.PID);
            }
            else
            {
                return(false);
            }
        }

        _repository.Save(process);
        return(true);
    }
Esempio n. 2
0
 public List <Process> GetRunningProcessesOrderedByPriority()
 {
     return(_repository.GetAllSortedByPriority().ToList());
 }