Question: This code is currently setting the schedule for an xv6 practice operating system and I was wondering how to modify this code from it's current
This code is currently setting the schedule for an xv6 practice operating system and I was wondering how to modify this code from it's current state, Round Robin, to MLFQ?
scheduler(void) { struct proc *p;
for(;;){ // Enable interrupts on this processor. sti();
// 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. proc = p; switchuvm(p); p->state = RUNNING; swtch(&cpu->scheduler, proc->context); switchkvm();
// Process is done running for now. // It should have changed its p->state before coming back. proc = 0; } release(&ptable.lock);
} }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
