diff --git a/Sim02/sim02 b/Sim02/sim02 index 199358a..4f7a00d 100755 Binary files a/Sim02/sim02 and b/Sim02/sim02 differ diff --git a/Sim02/simulator.c b/Sim02/simulator.c index f271348..f60797f 100644 --- a/Sim02/simulator.c +++ b/Sim02/simulator.c @@ -255,7 +255,8 @@ void logOutput(ConfigDataType *configPtr, char *logStr, bool isEnd) if(fileWritePtr != NULL) { // - printf("%s\n", logStr); + fprintf(fileWritePtr, "%s", logStr); + fprintf(stdout, "%s", logStr); } // no return, void // close the file, if at the end. @@ -302,19 +303,23 @@ void runSim(ConfigDataType *configPtr, OpCodeType *metaDataMstrPtr) pcbList = createProcessList(); // fill the process list given the metadata pcbList = fillProcessList(metaDataMstrPtr, pcbList); + pcbPtr = pcbList->headPtr; // create temp strings char *command; char *argument; // int iterator int pcbIterator; - // get the first data out of the metadata - command = metaDataMstrPtr->command; - argument = metaDataMstrPtr->strArg1; - - // set the master working pointer to the first metadata block - // wkgPtrMaster = metaDataMstrPtr; + // calculate pcb total time + int totalPCBTime = 0; + while(pcbPtr != NULL) + { + // + totalPCBTime = totalPCBTime + pcbPtr->timeLeft; + pcbPtr = pcbPtr->nextPtr; + } pcbPtr = pcbList->headPtr; + // set the current process id to the first scheduled process currentPid = scheduleProcess(pcbList, configPtr); // function holds master loop, loops until sys end opcode found OR wkgPtrMaster nextNode != NULL