Move scheduler(9) to sched_4bsd(9) and sync its contents with reality. Also
add a reference to McKusick et. al., which still contains the best in-depth description of the 4.4BSD scheduler.
This commit is contained in:
parent
63811f5275
commit
5c52ed78e9
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: mi,v 1.1046 2007/07/14 20:39:33 dsieger Exp $
|
||||
# $NetBSD: mi,v 1.1047 2007/07/14 21:54:31 dsieger Exp $
|
||||
./etc/mtree/set.comp comp-sys-root
|
||||
./usr/bin/addr2line comp-debug-bin bfd
|
||||
./usr/bin/ar comp-util-bin bfd
|
||||
|
@ -7261,10 +7261,10 @@
|
|||
./usr/share/man/cat9/rw_tryupgrade.0 comp-sys-catman .cat
|
||||
./usr/share/man/cat9/rw_write_held.0 comp-sys-catman .cat
|
||||
./usr/share/man/cat9/rwlock.0 comp-sys-catman .cat
|
||||
./usr/share/man/cat9/sched_4bsd.0 comp-sys-catman .cat
|
||||
./usr/share/man/cat9/sched_lock_idle.0 comp-sys-catman .cat
|
||||
./usr/share/man/cat9/sched_psignal.0 comp-sys-catman .cat
|
||||
./usr/share/man/cat9/sched_unlock_idle.0 comp-sys-catman .cat
|
||||
./usr/share/man/cat9/scheduler.0 comp-sys-catman .cat
|
||||
./usr/share/man/cat9/scsipi.0 comp-sys-catman .cat
|
||||
./usr/share/man/cat9/secmodel.0 comp-sys-catman .cat
|
||||
./usr/share/man/cat9/secmodel_bsd44.0 comp-sys-catman .cat
|
||||
|
@ -11601,10 +11601,10 @@
|
|||
./usr/share/man/man9/rw_tryupgrade.9 comp-sys-man .man
|
||||
./usr/share/man/man9/rw_write_held.9 comp-sys-man .man
|
||||
./usr/share/man/man9/rwlock.9 comp-sys-man .man
|
||||
./usr/share/man/man9/sched_4bsd.9 comp-sys-man .man
|
||||
./usr/share/man/man9/sched_lock_idle.9 comp-sys-man .man
|
||||
./usr/share/man/man9/sched_psignal.9 comp-sys-man .man
|
||||
./usr/share/man/man9/sched_unlock_idle.9 comp-sys-man .man
|
||||
./usr/share/man/man9/scheduler.9 comp-sys-man .man
|
||||
./usr/share/man/man9/scsipi.9 comp-sys-man .man
|
||||
./usr/share/man/man9/secmodel.9 comp-sys-man .man
|
||||
./usr/share/man/man9/secmodel_bsd44.9 comp-sys-man .man
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.242 2007/07/14 20:39:37 dsieger Exp $
|
||||
# $NetBSD: Makefile,v 1.243 2007/07/14 21:54:31 dsieger Exp $
|
||||
|
||||
# Makefile for section 9 (kernel function and variable) manual pages.
|
||||
|
||||
|
@ -40,7 +40,7 @@ MAN= altq.9 arc4random.9 arp.9 audio.9 autoconf.9 \
|
|||
preempt.9 \
|
||||
radio.9 ras.9 rasops.9 ratecheck.9 resettodr.9 rnd.9 rssadapt.9 \
|
||||
rt_timer.9 rwlock.9 RUN_ONCE.9 \
|
||||
SCHED_LOCK.9 scheduler.9 scsipi.9 \
|
||||
SCHED_LOCK.9 sched_4bsd.9 scsipi.9 \
|
||||
secmodel.9 secmodel_bsd44.9 secmodel_overlay.9 \
|
||||
setjmp.9 shutdownhook_establish.9 \
|
||||
signal.9 softintr.9 spl.9 splraiseipl.9 store.9 suspendsched.9 \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: scheduler.9,v 1.7 2006/12/23 09:21:10 wiz Exp $
|
||||
.\" $NetBSD: sched_4bsd.9,v 1.1 2007/07/14 21:54:30 dsieger Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
|
@ -34,35 +34,26 @@
|
|||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd December 2, 2006
|
||||
.Dt SCHEDULER 9
|
||||
.Dd July 14, 2007
|
||||
.Dt SCHED_4BSD 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm scheduler ,
|
||||
.Nm resetpriority ,
|
||||
.Nm roundrobin ,
|
||||
.Nm rqinit ,
|
||||
.Nm schedclock ,
|
||||
.Nm schedcpu ,
|
||||
.Nm setrunnable ,
|
||||
.Nm updatepri
|
||||
.Nd thread scheduling sub-system
|
||||
.Nm sched_4bsd
|
||||
.Nd The 4.4BSD thread scheduler
|
||||
.Sh SYNOPSIS
|
||||
.In sys/sched.h
|
||||
.In sys/lwp.h
|
||||
.In sys/proc.h
|
||||
.Ft void
|
||||
.Fn resetpriority "struct lwp *l"
|
||||
.Fn resetpriority "lwp_t *l"
|
||||
.Ft void
|
||||
.Fn roundrobin "struct cpu_info *ci"
|
||||
.Fn sched_tick "struct cpu_info *ci"
|
||||
.Ft void
|
||||
.Fn schedclock "struct lwp *l"
|
||||
.Fn sched_schedclock "lwp_t *l"
|
||||
.Ft void
|
||||
.Fn schedcpu "void *arg"
|
||||
.Fn sched_pstats_hook "struct proc *p, int minslp"
|
||||
.Ft void
|
||||
.Fn setrunnable "struct lwp *l"
|
||||
.Fn sched_setrunnable "lwp_t *l"
|
||||
.Ft void
|
||||
.Fn updatepri "struct lwp *l"
|
||||
.Fn updatepri "lwp_t *l"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nx
|
||||
|
@ -76,36 +67,24 @@ recomputes the priority of a thread running in user mode.
|
|||
If the resulting priority is higher than that of the
|
||||
current thread, a reschedule is arranged.
|
||||
.Pp
|
||||
.Fn roundrobin
|
||||
.Fn sched_tick
|
||||
gets called from
|
||||
.Xr hardclock 9
|
||||
every 100ms to force a switch between equal priority threads.
|
||||
.Pp
|
||||
The runqueues are initialized through
|
||||
.Fn rqinit ,
|
||||
called from
|
||||
.Fn init_main
|
||||
at system startup.
|
||||
.Pp
|
||||
The priority of the current thread is adjusted through
|
||||
.Fn schedclock .
|
||||
.Fn sched_schedclock .
|
||||
The priority of a thread gets worse as it accumulates CPU time.
|
||||
.Pp
|
||||
The
|
||||
.Fn schedcpu
|
||||
function recomputes the priorities of all threads every Hz ticks.
|
||||
.Fn sched_pstats_hook
|
||||
gets called from
|
||||
.Fn sched_pstats
|
||||
every Hz ticks in order to recompute the priorities of all threads.
|
||||
.Pp
|
||||
The
|
||||
.Fn setrunnable
|
||||
function changes a thread's state to be runnable.
|
||||
If the thread is in memory, it is placed on the proper runqueue,
|
||||
according to its priority.
|
||||
Otherwise the swapper is awakened.
|
||||
.Pp
|
||||
The
|
||||
.Fn sched_setrunnable
|
||||
checks if an LWP has slept for more than one second. If so, its
|
||||
priority is updated by
|
||||
.Fn updatepri
|
||||
function recalculates the priority of a thread after it has been
|
||||
sleeping.
|
||||
.Sh CODE REFERENCES
|
||||
This section describes places within the
|
||||
.Nx
|
||||
|
@ -113,11 +92,19 @@ source tree where actual code implementing the scheduler can be found.
|
|||
All pathnames are relative to
|
||||
.Pa /usr/src .
|
||||
.Pp
|
||||
The scheduler subsystem is implemented within the file
|
||||
.Pa sys/kern/kern_synch.c .
|
||||
The 4.4BSD scheduler subsystem is implemented within the file
|
||||
.Pa sys/kern/sched_4bsd.c .
|
||||
.Sh SEE ALSO
|
||||
.Xr SCHED_LOCK 9 ,
|
||||
.Xr csf 9 ,
|
||||
.Xr hardclock 9 ,
|
||||
.Xr mi_switch 9 ,
|
||||
.Xr setrunqueue 9 ,
|
||||
.Xr userret 9
|
||||
.Rs
|
||||
.%A Marshall Kirk McKusick
|
||||
.%A Keith Bostic
|
||||
.%A Michael J. Karels
|
||||
.%A John S. Quarterman
|
||||
.%B "The Design and Implementation of the 4.4BSD Operating System"
|
||||
.%I "Addison Wesley"
|
||||
.%D 1996
|
||||
.Re
|
Loading…
Reference in New Issue