From: Rik van Riel <riel@conectiva.com.br> To: Gary Thorpe <gathorpe79@yahoo.com> Cc: freebsd-arch@freebsd.org Subject: Re: New Linux threading model Message-ID: <Pine.LNX.4.44L.0209201640450.1857-100000@imladris.surriel.com> In-Reply-To: <20020920171317.77976.qmail@web11207.mail.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 20 Sep 2002, Gary Thorpe wrote: > So what happens if a processes has been sitting in the > queue waiting for a very long time: depending of the > scheduling algorithm, it may need to have its priority > increased the longer it waits but this will not > happen...until it is scheduled? Can this lead to > starvation? Nope, the O(1) scheduler has some tricks to avoid starvation. The main thing here is that it uses 2 priority arrays, one for tasks that have time in their current time slice left (current) and one or tasks that have run out of time slice (expired). As long as the tasks on the expired queue aren't being starved yet, interactive tasks hop on and off the current priority array and the expired tasks just sit there ... ... but once the oldest task on the expired array has been sitting there for some time (default is 3 seconds, I think) the kernel will add newly woken up tasks to the expired array. It will keep running the tasks from the current array until the time slices are all gone and then it switches arrays, running tasks from the expired array. No starvation. > > There don't seem to be any O(n) loops left in or > > near this scheduler, > > meaning that 1:1 threading with lots of threads > > becomes possible. > > The maximum parallelism on a given SMP system can > never be more than the number of CPUs so wouldn't a 1 > : 1 model lead to unnecessary overhead? Your threads never block on IO ? Or page faults, for that matter ? regards, Rik -- Bravely reimplemented by the knights who say "NIH". http://www.surriel.com/ http://distro.conectiva.com/ Spamtraps of the month: september@surriel.com trac@trac.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.44L.0209201640450.1857-100000>