public bool PreviousStep()
        {
            int actualstep = Step;

            actualstep--;
            Step = 0;

            if (actualstep >= 0)
            {
                SimulatorModel = new TS_SimulatorModel();

                try
                {
                    SimulatorModel.CreateSimulatorDomain(InputDescriptor);
                    for (int i = 0; i < actualstep; i++)
                    {
                        NextStep();
                    }
                }
                catch (Exception e)
                {

                }
            }

            GC.Collect();

            return true;
        }
Example #2
0
        public Metrics(TS_SimulatorModel simulatorModel, TS_Descriptor descriptor)
        {
            this.simulatorModel = simulatorModel;

            avarageOverheadTimeInOneThousandthMs = (double)descriptor.AvarageOverheadTime/1000.0;
            countOfMillisecondsWhereProcessWasRunning = countOfMillisecondsWhereProcessWasNotRunning = 0;
            countOfContextSwitchings = CountOfTaskSchedulings = 0;
        }
        public Resource(ResourceDescriptor resourceDescriptor, TS_SimulatorModel simulatorModel)
        {
            queue = new ObservableCollection<ResourceRecord>();
            currentlyUsing = new ObservableCollection<ResourceRecord>();
            ResourceName = resourceDescriptor.ResourceName;
            Quantity = resourceDescriptor.Quantity;

            this.simulatorModel  = simulatorModel;
        }
Example #4
0
 public RR(TS_SimulatorModel simulatorModel, ObservableCollection<string> parameters)
 {
     this.simulatorModel = simulatorModel;
     timeLimit = Convert.ToInt32(parameters.First());
     if (timeLimit <= 0)
     {
         timeLimit = 1;
     }
     actualTime = 0;
 }
Example #5
0
 public SJF(TS_SimulatorModel simulatorModel, ObservableCollection<string> parameters)
 {
     this.simulatorModel = simulatorModel;
 }
Example #6
0
 public SRTF(TS_SimulatorModel simulatorModel, ObservableCollection<string> parameters)
 {
     this.simulatorModel = simulatorModel;
     savedQueue = new ObservableCollection<Process>();
 }
Example #7
0
        public Process(TS_SimulatorModel simulatorModel, ProcessDescriptor processDescriptor, ObservableCollection<Resource> Resources) 
        {
            this.simulatorModel = simulatorModel;

            //ProcessStatus = ProcessStatusEnum.Undefined;
            ProcessName = processDescriptor.ProcessName;
            ArrivalTime = processDescriptor.ArrivalTime;

            // Burst-ök ellenőrése, amelyiknél nincs megfelelő erőforrás definiálva, törlésre kerül.
            BurstSequence = new ObservableCollection<BurstDescriptor>(processDescriptor.BurstSequence);
            List<BurstDescriptor> burstsWithIllegalResourceList = new List<BurstDescriptor>();
            foreach (BurstDescriptor burst in BurstSequence)
            {
                if (burst.BurstTime <= 0)
                {
                    burstsWithIllegalResourceList.Add(burst);
                    break;
                }

                if (burst.GetType() == typeof(IoBurstAsynchronousDescriptor)
                    || burst.GetType() == typeof(IoBurstSynchronousDescriptor))
                {
                    IoBurstDescriptor burstToCheckResource = (IoBurstDescriptor)burst;
                    
                    bool isResourceDefined = false;
                    foreach (Resource resource in Resources)
                    { 
                        if (resource.ResourceName.Equals(burstToCheckResource.ResourceName))
                        {
                            isResourceDefined = true;
                            break;
                        }
                    }
                    if (! isResourceDefined)
                    {
                        burstsWithIllegalResourceList.Add(burst);
                    }
                }
            }
            foreach (BurstDescriptor illegalBurst in burstsWithIllegalResourceList)
            {
                BurstSequence.Remove(illegalBurst);
            }

            // alapértékek beállítása az esetlegesen módosított BurstSequence alapján
            cpuTimeLeft = asynchronousTimeRunned = synchronousTimeRunned = 0;
            cpuTimeLeft = asynchronousTimeLeft = synchronousTimeLeft = 0;
            foreach (CpuBurstDescriptor burst in BurstSequence.OfType<CpuBurstDescriptor>())
            {
                cpuTimeLeft += burst.BurstTime;
            }
            foreach (IoBurstAsynchronousDescriptor burst in BurstSequence.OfType<IoBurstAsynchronousDescriptor>())
            {
                asynchronousTimeLeft += burst.BurstTime;
            }
            foreach (IoBurstSynchronousDescriptor burst in BurstSequence.OfType<IoBurstSynchronousDescriptor>())
            {
                synchronousTimeLeft += burst.BurstTime;
            }
            
        }