[SqNOS] ioRelinquishProcessor, timer, power consumption and IRQs

Gerardo Richarte gera at corest.com
Wed Jul 19 00:30:50 UTC 2006


Hi,

    since the biggining I thought that it was a good idea to replace all 
code in ioRelinquishProcessor for a simple hlt assembly instruction. hlt 
puts the processor in a suspended state until a new IRQ comes in. Using 
hlt will (hopefully) reduce power consumption...

    When I did my first tries, SqueakNOS almost died (was incredible 
slow), and thinking I realized that timer IRQs, by default, come only at 
18.2Hz in PCs, and by reading the comment in ioRelinquishProcessor and 
looking up every uses of it in Squeak I realized that 
ioRelinquishProcessor must not take longer than the requested time, and 
it's always called with either 1ms and .5 ms (that's 1KHz and 2KHz). So, 
as I was doing hlt and only returning at 18.2 Hz, everything was, 
understandably, slower.

    At the time I decided I had to increse the timer frequency to at 
least 2KHz and then hlt would be ok, but until now I haven't done it. 
Changing the PCs timer frequency is not a big deal, but I was lazzy on 
touching the native part.

    I finally did the change a few days ago, but after doing it the 
internat clock was kind of too fast (2x), now I had the time to take a 
look, and a stupid bug was making SqueakNOS set a 4KHz+ frequency. Fixed 
the bug, fixed the time speed difference.

    Now SqueakNOS runs with a 2KHz time resolution, and does hlt on 
ioRelinquishProcessor. I thin this is correct, as every external event 
can only be triggered by IRQs (be it a Delay or a Network packet or 
mouse move).

    At the same time, incresing the timer will supposedly put more 
preasure on the processor, because it has to deal with more IRQs per 
second, but it's no big deal I think, and improving the timer resolution 
it's a must IMHO, and the lower power consumption it's a very desirable 
side effect...

    oh well... my emails are always long...
    do you see any drawback in doing this?

    gera


More information about the SqueakNOS mailing list