Controller loops

vuletich at ar.ibm.com vuletich at ar.ibm.com
Fri Sep 4 12:10:52 UTC 1998





To:   squeak at cs.uiuc.edu
cc:

From:



Hello everybody.

We know that Squeak uses all the available CPU time even when it is not
doing anything.
I have seen that in Squeak there is a background process that runs:
---------------------------------------------------------
ProcessorScheduler>>idleProcess
     "A default background process which is invisible."
     [true] whileTrue:
          [self relinquishProcessorForMicroseconds: 1000].
---------------------------------------------------------
But this process is never executed because there is always a higher
priority Controller
process running. In the method:
------------------------------------------------------
Controller>>controlLoop
     "Sent by Controller|startUp as part of the standard control sequence.
     Controller|controlLoop sends the message Controller|isControlActive to
 test
     for loop termination. As long as true is returned, the loop continues.

     When false is returned, the loop ends. Each time through the loop, the

     message Controller|controlActivity is sent."

     [self isControlActive] whileTrue: [self controlActivity. Processor
yield]
-------------------------------------------------------
the Processor yield can be changed for (Delay forMilliseconds:50) wait.
This makes the
MVC controllers poll for activity no more than 20 times a second, what is
perfectly enough.

I found that this frees almost all the processor time to other programs in
a multitasking OS.
All that is needed is to have the ioRelinquishProcessorForMicroseconds()
function in the
VM properly implemented. I tried it and works OK in Windows and OS/2
versions of Squeak.
The same should be done in ScrollController>>scroll.

It can also be done in MorphWorldController >>controlLoop, but Morphic
prefers to to have
its step intervals as short as possible.

Does this modification deserve to be in the base image?

Juan Manuel Vuletich
jvuletic at dc.uba.ar





More information about the Squeak-dev mailing list