UserIF and background processes (was: MVC Model)
Andreas Raab
raab at isgnw.cs.Uni-Magdeburg.DE
Fri Apr 17 08:57:42 UTC 1998
Bill,
Here are a few attempts to answer some of your questions.
> But in tracing through the isControlActive and
> controlActivity methods I didn't see anything that would allow lower
> priority (background) processes to run. A test seems to confirm this.
True. But you can easily make a background process run by adding a delay
in Controller>>controlLoop i.e.
controlLoop
[self isControlActive] whileTrue:[
self controlActivity.
(Delay forMilliseconds: 5) wait.
Processor yield].
> Also, even though the UserIF process looks like it is constantly
> polling, it only seems to use a very modest fraction of the CPU. On the
> other hand, a compute loop can easily suck 100% of the CPU.
>
> How is this magic accomplished?
Assuming that you're on Windows the answer is: By statistics ;-)
I noticed that there are several thousend polls per second in an idle UI
process and added a delay on the VM side in case there are no pending
events. This leads to a heavily reduced CPU usage in case the image is
just polling (such as in idle UI processes). When doing some *real*
work, polling occurs only occasionally (every half a second, mainly to
check for interrupts) and the delay in the VM is not noticable.
> Where does the user interrupt (ctrl-break in my world) get passed
> into the image?
When a user interrupt occurs the UserInterruptSemaphore is signaled (see
InputSensor) and handled by the appropriate user interrupt watcher.
Andreas
--
Linear algebra is your friend - Trigonometry is your enemy.
+===== Andreas Raab ============= (raab at isg.cs.uni-magdeburg.de) =====+
I Department of Simulation and Graphics Phone: +49 391 671 8065 I
I University of Magdeburg, Germany Fax: +49 391 671 1164 I
+=============< http://isgwww.cs.uni-magdeburg.de/~raab >=============+
More information about the Squeak-dev
mailing list
|