Question
Priority based round robin scheduling walkthrough Priority based Round-Robin CPU Scheduling algorithm is based on the integration of round-robin and priority scheduling algorithm. It retains
Priority based round robin scheduling walkthrough
Priority based Round-Robin CPU Scheduling algorithm is based on the integration of round-robin and priority scheduling algorithm. It retains the advantage of round robin in reducing starvation and integrates the advantage of priority scheduling.
- 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
void
scheduler(void)
{
struct proc *p, *p1;
struct cpu *c = mycpu();
c->proc = 0;
for(;;){
// Enable interrupts on this processor.
sti();
struct proc *highP;
// 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 > p1->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.
Can someone help me to solve it using ubuntu, please? My laptop is broken please help me?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started