proc.c
//function useful for priority scheduling (yield is called if the current priority is not lowesst)
function useful for priority scheduling (yield is called if the current priority is not lowesst)
function useful for priority scheduling ( yield is called if the current priority is not lowesst )
int compare_priority(int pri)
{
  struct proc *p = NULL;
  acquire(&ptable.lock);
  for (p = ptable.proc; p < &ptable.proc[NPROC]; p++)
  {
    if (p->state != RUNNABLE)
    {
      continue;
    }
    if (p->priority <= pri)
    {
      release(&ptable.lock);
      return 1;
    }
  }
  release(&ptable.lock);
  return 0;
}
int compare_priority ( int pri ) { struct proc * p = NULL ; acquire ( & ptable . lock ) ; for ( p = ptable . proc ; p < & ptable . proc [ NPROC ] ; p ++ ) { if ( p -> state != RUNNABLE ) { continue ; } if ( p -> priority <= pri ) { release ( & ptable . lock ) ; return 1 ; } } release ( & ptable . lock ) ; return 0 ; }
function useful for priority scheduling (yield is called if the current priority is not lowesst)
function useful for priority scheduling ( yield is called if the current priority is not lowesst )
// int f1=0; // f1=1; // break;