Path: utzoo!utgpu!attcan!uunet!lll-winken!ames!haven!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.unix.wizards Subject: Re: Time slicing -- How does 4.3bsd do it? Message-ID: <15504@mimsy.UUCP> Date: 18 Jan 89 04:47:29 GMT References: <1798@maccs.McMaster.CA> Distribution: na Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 22 In article <1798@maccs.McMaster.CA> dan@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@mimsy.umd.edu Path: uunet!mimsy!chris