diff --git a/allocate.c b/allocate.c index 13776a7b773f5a489eccb685b58471a59653dae2..17748f26c25692593ca83488548bf178bd1a402c 100644 --- a/allocate.c +++ b/allocate.c @@ -453,7 +453,7 @@ process *getNextProcess(FILE *f, llist *arrivals, process *readAhead) { llist_print(arrivals,(void (*)(void *)) &printQEntry); headProcess = headData(arrivals); - if (headProcess != NULL){//thare are processes in arrivals + if (headProcess != NULL){//there are processes in arrivals return llist_pop(arrivals); } @@ -541,11 +541,12 @@ process *getNextProcessB(FILE *f, llist *arrivals, process *readAhead) { int batchEnd; if (arrivals != NULL) { - if (headData(arrivals) == NULL) {// no buffered processes so...{ + if (headData(arrivals) == NULL && readAhead->timeArrived != -1) {// no buffered processes so...{ // queue the next batch of arrivals - starting with the read ahead. newProcess = malloc(sizeof(process)); memcpy(newProcess, readAhead, sizeof(process)); llist_add_inorder(newProcess, arrivals, (int (*)(void *, void *)) &leastExecutionTime); + //llist_print(); while (readAhead->timeArrived != -1 && !batchEnd) { if (fgets(line, sizeof line, f) != NULL) { initializeProcess(line, newProcess);