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"); }
public void Start() { string line = ""; int currentIndex = 0; int currentJob = 0; string[] splitLine; PCB pcb; while (!loadingComplete) { line = fileReader.ReadLine(); if (line != null) { if (line.Contains("JOB")) { splitLine = line.Split("\\s+"); currentJob = Convert.ToInt32(splitLine[JOB_NUM_POS], 16); PCBManager.insertPCB(new PCB(currentJob, Convert.ToInt32(splitLine[JOB_PRIORITY_POS], 16), Convert.ToInt32(splitLine[JOB_INSTR_COUNTR_POS], 16), currentIndex)); } else if (line.Contains("Data")) { splitLine = line.Split("\\s+"); if (PCBManager.getCurrentPcbSortType() != PCBManager.PCB_SORT_TYPE.JOB_NUMBER) { PCBManager.sortPcbList(PCBManager.PCB_SORT_TYPE.JOB_NUMBER); } PCB currentPCB = PCBManager.getPCB(currentJob); currentPCB.setDataDiskAddress(currentIndex); currentPCB.setInputBuffer(Convert.ToInt32(splitLine[DATA_IN_BUFF_POS], 16)); currentPCB.setOutputBuffer(Convert.ToInt32(splitLine[DATA_OUT_BUFF_POS], 16)); currentPCB.setTemporaryBuffer(Convert.ToInt32(splitLine[DATA_TEMP_BUFF_POS], 16)); } else if (line.Contains("END")) { } else { Disk.writeDisk(line, currentIndex); currentIndex++; } } else { loadingComplete = true; } } }