Skip to content

Commit

Permalink
commenting round 2
Browse files Browse the repository at this point in the history
  • Loading branch information
uditvyas committed Nov 28, 2020
1 parent 292b4a5 commit 59d5212
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,35 +405,38 @@ check_unused(struct proc **q_c,int *current)
}
}
}
/*--------END--------*/


/*MLFQ MODIFICATION*/

// GENERALISED FUNCTION FOR HANDLING ALL THE MLFQ OPERATIONS
// INPUT: CURRENT QUEUE, NEXT QUEUE, CURRENT QUEUE INDEX, NEXT QUEUE INDEX
// INPUT: CPU, CURRENT_QUEUE_ID, NEXT_QUEUE_ID


/*
MLFQ ROUND ROBIN IMPLEMENTATION
*/
void
mlfq(struct proc **q_current,struct proc **q_next,int *current, int *next,struct cpu *c, int num1, int num2)
mlfq(struct proc **q_current,struct proc **q_next,int *current, int *next,struct cpu *c, int cur_q_id, int nxt_q_id)
{

// check_unused(q_current,current);
struct proc *p;

// LOOPING OVER ALL PROCESSES IN THE CURRENT QUEUE
for(int i=0;i<*current+1;i++){

// ENSURING THAT THERE IS NO PROCESS IN THE HIGHER QUEUES
if(flag0) return;
if(flag1==1 && num1>=1) return;
if(flag2==1 && num2>=2) return;
if(flag1==1 && cur_q_id>=1) return;
if(flag2==1 && nxt_q_id>=2) return;

// while(i<*current+1){
// SELECTING A PROCESS
p = q_current[i];
// rerun:

// ENSURING THAT THE PROCESS IS RUNNABLE
if(p->state != RUNNABLE){
// cprintf("PState %d\n",p->state);
continue;
}
check_unused(q_current,current);
c->proc = p;

// if(num1!=p->priority)cprintf("ERROR PROCPrio: %d \t REQPrio : %d \t PROCName : %s!!\n",p->priority,num1,p->name);

switchuvm(p);
p->state = RUNNING;

Expand Down

0 comments on commit 59d5212

Please sign in to comment.