コード例 #1
0
        public static void run()
        {
            RAM.init();
            Disk.init();
            PCBManager.init();
            osStartTime = DateTimeOffset.Now.ToUnixTimeMilliseconds();

            Loader loader = new Loader("C:/Users/HOME/Documents/Visual Studio 2017/Projects/OSSImulator/OS-Simulator/OSSImulator/OSSImulator/Program-File.txt");

            loader.Start();

            jobMetricses = new JobMetrics[PCBManager.getJobListSize()];
            for (int i = 0; i < jobMetricses.Length; i++)
            {
                jobMetricses[i] = new JobMetrics();
            }


            string s = Disk.readDisk(2);

            Console.WriteLine("DISK TEST: " + s);

            while (custardStands())
            {
                ready();
                aim((schedulingType != null) ? schedulingType : Schedulingtype.FIFO);
                fire();
            }
        }
コード例 #2
0
 public void Schedule()
 {
     if (!RAM.isRAWFull())
     {
         int totalJobs = PCBManager.getJobListSize();
         for (int i = 1; i <= totalJobs; i++)
         {
             if (!PCBManager.getPCB(i).isJobInMemory() && PCBManager.getPCB(i).getProcessStatus() == PCB.PROCESS_STATUS.NEW && !RAM.isRAWFull())
             {
                 loadJobToRAM(PCBManager.getPCB(i));
             }
         }
     }
 }
コード例 #3
0
        public void FIFOSChedule()
        {
            int totalJobs = PCBManager.getJobListSize();

            if (PCBManager.getCurrentPcbSortType() != PCBManager.PCB_SORT_TYPE.JOB_NUMBER)
            {
                ;
            }
            {
                PCBManager.sortPcbList(PCBManager.PCB_SORT_TYPE.JOB_NUMBER);
            }
            if (readyQueue.Count() == 0)
            {
                readyQueue.Clear();
            }
            for (int i = 1; i < totalJobs + 1; i++)
            {
                readyQueue.Add(PCBManager.getPCB(i));
            }
            sortType = PCBManager.PCB_SORT_TYPE.JOB_NUMBER;
        }
コード例 #4
0
 public static void updateOsMetric()
 {
     int       jobsInProgress = numberOfBusyCpus();
     OSMetrics osMetrics      = new OSMetrics(PCBManager.getJobListSize(), numberOfBusyCpus(), completedJobs, getAverageWaitTime(), getAverageRunTime());
     //update OsMetrics
 }