man.bsd.lv manual page server

Manual Page Search Parameters

SCHED_4BSD(9) Kernel Developer's Manual SCHED_4BSD(9)

sched_4bsdThe 4.4BSD thread scheduler

#include <sys/sched.h>

void
resetpriority(lwp_t *l);

void
sched_tick(struct cpu_info *ci);

void
sched_schedclock(lwp_t *l);

void
sched_pstats_hook(struct proc *p, int minslp);

void
sched_setrunnable(lwp_t *l);

void
updatepri(lwp_t *l);

The traditional 4.4BSD scheduler employs a “multilevel feedback queues” algorithm, favouring interactive, short-running threads to CPU-bound ones.

() 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.

() gets called from hardclock(9) every 100ms to force a switch between equal priority threads.

The priority of the current thread is adjusted through (). The priority of a thread gets worse as it accumulates CPU time.

() gets called from () every Hz ticks in order to recompute the priorities of all threads.

() checks if an LWP has slept for more than one second. If so, its priority is updated by ().

To determine the scheduler currently in use

$ sysctl kern.sched.name
kern.sched.name = 4.4BSD

The 4.4BSD scheduler subsystem is implemented within the file sys/kern/sched_4bsd.c.

csf(9), hardclock(9), mi_switch(9), sched_m2(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.

April 9, 2019 NetBSD-9.2