Time slicing -- How does 4.3bsd do it?

Chris Torek chris at mimsy.UUCP
Wed Jan 18 14:47:29 AEST 1989


In article <1798 at maccs.McMaster.CA> dan at maccs.McMaster.CA (Dan Trottier)
writes:
>A user asked me how much of a time quantum he gets by default when
>he logs into the system. In trying to explain how the cpu shares its
>resources I discovered that I really didn't understand it myself.

4.3BSD uses a `round robin' priority based scheduler, with 32 priority
queues.  A process's priority is based on a complex and unreasonable
function of its nice, whether it is in a system call, how much cpu time
it has had recently, and the load average.  Ten times each second,
the `roundrobin' function in /sys/sys/kern_sched.c arranges for the
current process, whatever it may be, to be descheduled and the next
eligible process (possibly the one descheduled) to be scheduled.

Thus, if by `quantum' you mean the typical scheduler quantum, the value
is essentially random, depending on when the process was scheduled with
respect to the constant 100 ms ticks.  In the absence of clock-related
voluntary context switching, the unfairness should average out to the
point where it can be ignored, but that absence is not guaranteed.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.unix.wizards mailing list