[haiku-development] Re: scheduler (was GCC 2 x GCC 4)
- From: "André Braga" <meianoite@xxxxxxxxx>
- To: haiku-development@xxxxxxxxxxxxx
- Date: Thu, 28 Aug 2008 05:22:01 -0300
On Thu, Aug 28, 2008 at 05:05, André Braga <meianoite@xxxxxxxxx> wrote:
> Hints: add an extra dash in line 119 so that it reads "---[[" instead
> of "--[["; this will print the elements IDs as they're scheduled; but
> if you do, remember to change the value in line 138 to a much smaller
> number, preferrably a multiple of cumulativePriority (i.e., summation
> of all the thread priorities in all runqueues), else it will print
> over 9000 lines of text! In the example, cumulativePriority = 10 + 10
> + 20 + 20 + 30 = 90, so I suggest using a smaller multiple of 90.
>
> You can find the code here: http://pastebin.com/m5330479a
> And you can run it by pasting it here: http://www.lua.org/cgi-bin/demo
*OOPS.*
Replace lines 115 to 123 with:
function schedule(rq)
a = rq:run()
rq:rebuild()
--[[
print ("Picked: " .. a.id)
--rq:print()
--]]
end
BTW, unless you REALLY love text scrolling around your screen, leave
rq:print() commented. But it's quite interesting to enable it and see
what's going on there for a smaller number of scheduling rounds (line
138).
BTW2, if you use a named variable as the index instead of the
underscore on the loop in line 138, and add an argument to schedule()
(line 115), and modify the print() statement (line 120) to output both
the loop index and the ID, and then plot the result, you'll see a
quite nice regular, sawtooth-like graph. That's a priority-oriented
fair scheduler in action :)
Cheers,
A.
- References:
- [haiku-development] Re: scheduler (was GCC 2 x GCC 4)
- From: Ari Haviv
- [haiku-development] Re: scheduler (was GCC 2 x GCC 4)
- From: André Braga
Other related posts:
- » [haiku-development] Re: scheduler (was GCC 2 x GCC 4)
- » [haiku-development] Re: scheduler (was GCC 2 x GCC 4)
- » [haiku-development] Re: scheduler (was GCC 2 x GCC 4)
- [haiku-development] Re: scheduler (was GCC 2 x GCC 4)
- From: Ari Haviv
- [haiku-development] Re: scheduler (was GCC 2 x GCC 4)
- From: André Braga