Beispiel #1
0
        public void load(PCB job)
        {
            Console.WriteLine("cpu.loading job: " + job.getJobNumber());
            jobNumber = job.getJobNumber();
            printFlags("PRE LOADING");
            // int instructionCounter = 1;
            jobMemoryStartAddress = job.getJobMemoryAddress();
            start            = DateTimeOffset.Now.ToUnixTimeMilliseconds();
            j                = job;
            IOCount          = 0;
            tempBuffer       = j.getTemporaryBuffer();
            inputBuffer      = j.getInputBuffer();
            outputBuffer     = j.getOutputBuffer();
            jobCounter       = j.getJobInstructionCount();
            cacheSize        = tempBuffer + inputBuffer + outputBuffer + jobCounter;
            cache            = new String[cacheSize];
            instructionCache = new String[jobCounter];
            VMA              = job.getAllocatedVirtualPages();

            for (int i = 0; i < cacheSize; i++)
            {
                cache[i] = read(i);
            }

            programCounter = j.getProgramCounter();
            setIdleFlag(false);
            setTerminateFlag(false);
            setJobLoaded(true);
            Console.WriteLine("cpu.loading jon: " + job.getJobNumber() + " complete");
            updateMetrics(CPUMetrics.CPU_STATE.LOADING, "N/A");
            sleep(3);
            updateOsMetrics();
            printFlags("POST LOADING");
        }