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.

  1. 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

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 Databases Questions!