Skip to content
Snippets Groups Projects
Commit c23b9ce3 authored by Elizabeth Baker's avatar Elizabeth Baker
Browse files

buffProc -not for task4 test 2

parent a975c620
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment