Unix & pegging the CPU for idle Squeak, a question...

Lex Spoon lex at cc.gatech.edu
Thu May 24 21:10:14 UTC 2001


John M McIntosh <johnmci at smalltalkconsulting.com> wrote:
> This is regarding the Carbon Squeak VM
> 
> At 7:30 PM -0500 5/22/01, Aaron J Reichow wrote:
> >I don't know if you're aware of it, but just haven't found a solution, but
> >Squeak sucks up as much CPU time as it can get.  With top running:
> >
> >6318 top         12.7%  0:02.60   1    20    15   284K   220K   508K  1.39M
> >6316 Squeak VM   70.8%  0:31.43   2    79    79  13.5M  4.78M  17.4M  1.02G
> >
> >I'm sure it eats even more when top isn't running, seeing how that's using
> >so much CPU time itself.  This happens with the 3.0.16 (and .15) VM and
> >with both a pretty new 3.1a and clean 3.0 image.
> 
> Now I could go look, but since I'm quite busy at the moment perhaps 
> someone could tell me what the Unix VM does to avoid pegging the CPU.
> 


Why do anything?  The VM only eats CPU when there are bytecodes running.
 The best way to reduce CPU is not to run bytecodes!  Further, any
approach which suspends Squeak even though there is an active process,
might well be suspending activity that it shouldn't -- eg, maybe you're
in the middle of an expensive animation.

In Morphic, the system already limits itself to 50 frames per second (or
maybe it's 100 -- I forget).  For most images, 50/100 frames per second
requires very little CPU, and so that's all you need to do.

I'm not sure what's happening in the above situation.  It looks like the
ioRelinquishProcessor() call isn't being effective.  Or perhaps the
system is in MVC, in one of the difficult states.  Or perhaps there
really is an active animation running, such as a BouncingAtomsMorph.

One image-level change might help: have the idle loop compute the time
to wait depending on the time until the next Delay will wake up.  That
way, you can get some quite long ioRelinquish's, and long ioReliquish's
are probably easier to make effective than a series of short ones.

(And of course, be careful to account for the case that there is no
active delay!  I forgot this, once, and ended up with a thoroughly
messed up image!)


Lex





More information about the Squeak-dev mailing list