- NetBSD Manual Pages
SCHED_4BSD(9) NetBSD Kernel Developer's Manual SCHED_4BSD(9)
Powered by man-cgi (2021-06-01).
Maintained for NetBSD
by Kimmo Suominen.
Based on man-cgi by Panagiotis Christias.
sched_4bsd -- The 4.4BSD thread scheduler
sched_tick(struct cpu_info *ci);
sched_pstats_hook(struct proc *p, int minslp);
The NetBSD thread scheduling sub-system employs a ``multilevel feedback
queues'' algorithm, favouring interactive, short-running threads to CPU-
resetpriority() 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.
sched_tick() gets called from hardclock(9) every 100ms to force a switch
between equal priority threads.
The priority of the current thread is adjusted through
sched_schedclock(). The priority of a thread gets worse as it accumu-
lates CPU time.
sched_pstats_hook() gets called from sched_pstats() every Hz ticks in
order to recompute the priorities of all threads.
sched_setrunnable() checks if an LWP has slept for more than one second.
If so, its priority is updated by updatepri().
This section describes places within the NetBSD source tree where actual
code implementing the scheduler can be found. All pathnames are relative
The 4.4BSD scheduler subsystem is implemented within the file
csf(9), hardclock(9), mi_switch(9), userret(9)
Marshall Kirk McKusick, Keith Bostic, Michael J. Karels, and John S.
Quarterman, The Design and Implementation of the 4.4BSD Operating System,
Addison Wesley, 1996.
NetBSD 5.0.1 July 14, 2007 NetBSD 5.0.1