Next: Realtime
   Up: How The Linux Scheduler
   Previous: task_struct
  
  
  
  
   
  Scheduling in the Linux kernel happens in the function
  schedule().  A call to schedule() is made when one
  of the following three conditions holds:
  
  - 1.
  
 - The currently running task's need_resched is set and
  the task is returning from a system call.
  
 - 2.
  
 - The currently running task's counter is at 0 and the
    10 msec timer goes off.
  
 - 3.
  
 - The currently running task blocks or yields.
  
 
  
  Once a call to schedule() has been made, scheduling within schedule() proceeds as follows:
  
  - 1.
  
 - Administrative stuff is done.
  
  - (a)
  
 - task queue stuff is handled All of the functions on the task queue are called.
  
 - (b)
  
 - bottom half stuff is handled
  
 - (c)
  
 - If the last task was a realtime round robin task, it is moved to
  the end of the task queue so that those processes at the same
  priority (also realtime round robin) get to run before it.
  
 
   - 2.
  
 - The scheduler proper begins.
  
  if the run queue is empty run the init task. 
  else 
    
  - (a)
  
 - compute each runnable task's goodness  via the
  algorithm in Figure 1.
  
 - (b)
  
 - if all tasks have goodness  0 (their counters
      have all expired)
      
  -  reset all runnable tasks' counters to their
        respective prioritys and go back to 2.
      
 
  
  else
      
  -  find the task with the highest goodness value and choose it to run next.
      
 
 
 
    
  
  
  
  Figure 1:
  Computing a task's goodness .
    | 
  
   
  
  
  
  
 
  
  
 
  
  
   
  
   Next: Realtime
   Up: How The Linux Scheduler
   Previous: task_struct
  
  
  Brandon Sanders
  
12/17/1999