proc.c
void
sched(void)
{
  int intena;

  if(!holding(&ptable.lock))
    panic("sched ptable.lock");
  if(cpu->ncli != 1)
    panic("sched locks");
  if(proc->state == RUNNING)
    panic("sched running");
  if(readeflags()&FL_IF)
    panic("sched interruptible");
  intena = cpu->intena;
  swtch(&proc->context, cpu->scheduler);
  cpu->intena = intena;

   #ifdef FRR
  struct proc *p1;

  for(p1 = ptable.proc; p1 < &ptable.proc[NPROC]; p1++){
	if(p1->state == RUNNABLE)
		cprintf("<%d>,", (int)(p1->pid));
     }
  //cprintf("\n-----------------------------------------\n");
  #endif

}
// Enter scheduler.  Must hold only ptable.lock
// and have changed proc->state. Saves and restores
// intena because intena is a property of this
// kernel thread, not this CPU. It should
// be proc->intena and proc->ncli, but that would
// break in the few places where a lock is held but
// there's no process.
Enter scheduler.  Must hold only ptable.lock
and have changed proc->state. Saves and restores
intena because intena is a property of this
kernel thread, not this CPU. It should
be proc->intena and proc->ncli, but that would
break in the few places where a lock is held but
there's no process.
Enter scheduler . Must hold only ptable . lock and have changed proc - > state . Saves and restores intena because intena is a property of this kernel thread not this CPU . It should be proc - > intena and proc - > ncli but that would break in the few places where a lock is held but there ' s no process .
void
sched(void)
{
  int intena;
  if(!holding(&ptable.lock))
    panic("sched ptable.lock");
  if(cpu->ncli != 1)
    panic("sched locks");
  if(proc->state == RUNNING)
    panic("sched running");
  if(readeflags()&FL_IF)
    panic("sched interruptible");
  intena = cpu->intena;
  swtch(&proc->context, cpu->scheduler);
  cpu->intena = intena;
   #ifdef FRR
  struct proc *p1;
  for(p1 = ptable.proc; p1 < &ptable.proc[NPROC]; p1++){
	if(p1->state == RUNNABLE)
		cprintf("<%d>,", (int)(p1->pid));
     }
  #endif
}
void sched ( void ) { int intena ; if ( ! holding ( & ptable . lock ) ) panic ( " " ) ; if ( cpu -> ncli != 1 ) panic ( " " ) ; if ( proc -> state == RUNNING ) panic ( " " ) ; if ( readeflags ( ) & FL_IF ) panic ( " " ) ; intena = cpu -> intena ; swtch ( & proc -> context , cpu -> scheduler ) ; cpu -> intena = intena ; #ifdef FRR struct proc * p1 ; for ( p1 = ptable . proc ; p1 < & ptable . proc [ NPROC ] ; p1 ++ ) { if ( p1 -> state == RUNNABLE ) cprintf ( " " , ( int ) ( p1 -> pid ) ) ; } #endif }
Enter scheduler.
Enter scheduler .
//cprintf("\n-----------------------------------------\n");