Пример #1
0
        public void unload(PCB current)
        {
            updateMetrics(CPUMetrics.CPU_STATE.UNLOADING, "N/A");
            printFlags("PRE UNLOADING");
            Console.WriteLine("UNLOADING JOB " + currentJobNumber() + "PROGRAM COUNTER:" + programCounter + " JOB CNTR:" + jobCounter);

            current.setTemporaryBuffer(tempBuffer);
            current.setInputBuffer(inputBuffer);
            current.setOutputBuffer(outputBuffer);
            current.setJobinstructionCount(jobCounter);
            current.setRegisters(registers);
            current.setProgramCounter(programCounter);
            current.setCache(cache);
            current.setCacheSize(cacheSize);

            if (programCounter < jobCounter)
            {
                // setTerminateFlag(false);
                current.setProcessStatus(PCB.PROCESS_STATUS.WAIT);
            }
            else
            {
                // setTerminateFlag(true);
                current.setProcessStatus(PCB.PROCESS_STATUS.TERMINATE);
            }

            setIdleFlag(true);
            setUnload(false);
            setTerminateFlag(false);
            setJobLoaded(false);
            sleep(2);
            updateOsMetrics();
            updateMetrics(CPUMetrics.CPU_STATE.IDLE, "N/A");
            printFlags("POST UNLOADING");
        }