Question: For implementing this, make the required changes in scheduler function in proc.c file. / / Replace the scheduler function with the one below for priority

For implementing this, make the required changes in scheduler function in proc.c file.
//Replace the scheduler function with the one below for priority round robin scheduling// Loop over process table looking for process to run.acquire(&ptable.lock);for(p = ptable.proc; p &ptable.proc[NPROC]; p++){ if(p->state != RUNNABLE) continue; // Switch to chosen process. It is the process's job // to release ptable.lock and then reacquire it // before jumping back to us. highP = p; //choose one with highest priority for(p1= ptable.proc; p1 &ptable.proc[NPROC]; p1++){ if(p1->state != RUNNABLE) continue; if(highP->priority > pl->priority)//larger value, lower
priority
highP = p1;
}
p = highP;
c->proc = p;
switchuvm(p);
p->state = RUNNING;
swtch(&(c->scheduler), p->context);
switchkvm();
// Process is done running for now.
// It should have changed its p->state before coming back.
c->proc =0;
}
release(&ptable.lock);
}
}
At this step, you have implemented the system calls and changed the scheduling policy in xv6. Now, let us try it out.
For implementing this, make the required changes

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!