Move more scheduler-specific defines from various places into usched_bsd4.c
authorMatthew Dillon <dillon@dragonflybsd.org>
Sun, 26 Jun 2005 22:03:29 +0000 (22:03 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Sun, 26 Jun 2005 22:03:29 +0000 (22:03 +0000)
commita46fac569795b1bf185a087a96b50edbbd369015
treea3111eff77823fba2eb887a4ff45adc85942ea62
parent352f5709df95b465be87a555cba4de8ca47f9c07
Move more scheduler-specific defines from various places into usched_bsd4.c
and revamp our scheduler algorithms.

* Get rid of the multiple layers of abstraction in the nice and frequency
  calculations.

* Increase the scheduling freqency from 20hz to 50hz.

* Greatly reduce the number of scheduling ticks that occur before a
  reschedule is issued.

* Fix a bug where the scheduler was not rescheduling when estcpu drops
  a process into a lower priority queue.

* Implement a new batch detection algorithm.  This algorithm gives
  forked children slightly more batchness then their parents (which
  is recovered quickly if the child is interactive), and propogates
  estcpu data from exiting children to future forked children (which
  handles fork/exec/wait loops such as used by make, scripts, etc).

* Change the way NICE priorities effect process execution.  The NICE
  value is used in two ways:  First, it determines the initial process
  priority.  The estcpu will have a tendancy to correct for this so the NICE
  value is also used to control estcpu's decay rate.

  This means that niced processes will have both an initial penalty for
  startup and stabilization, and an ongoing penalty if they become cpu
  bound.

Examples from cpu-bound loops:

CPU PRI  NI   PID %CPU      TIME COMMAND
 42 159 -20   706 20.5   0:38.88 /bin/csh /tmp/dowhile
 37 159 -15   704 17.6   0:35.09 /bin/csh /tmp/dowhile
 29 157 -10   702 15.3   0:30.41 /bin/csh /tmp/dowhile
 28 160  -5   700 13.0   0:26.73 /bin/csh /tmp/dowhile
 23 160   0   698 11.5   0:20.52 /bin/csh /tmp/dowhile
 18 160   5   696  9.2   0:16.85 /bin/csh /tmp/dowhile
 13 160  10   694  7.1   0:10.82 /bin/csh /tmp/dowhile
  3 160  20   692  1.5   0:02.14 /bin/csh /tmp/dowhile
sys/dev/netif/iwi/if_iwi.c
sys/dev/netif/ndis/if_ndis.c
sys/dev/raid/twa/twa.c
sys/dev/raid/twe/twe.c
sys/kern/kern_synch.c
sys/kern/subr_param.c
sys/sys/param.h
sys/sys/proc.h
sys/sys/usched.h