Controller loops

Dwight Hughes dwighth at ipa.net
Sat Sep 5 02:18:54 UTC 1998


Doug Way wrote:
> 
> I tried it on Unix (SGI/Irix 6.3) and Windows NT 4.0, and your fix seems
> to work fine.  Very cool!  Didn't seem to have any noticable effect on
> performance.  (Oddly, the CPU meter under NT indicated that vanilla Squeak
> 2.1 didn't use 100% CPU for some reason... it does on the other platforms
> I've seen, though.)
> 

Squeak on Windows NT (and Win95/98) doesn't have the problem because
Andreas Raab compensated for it in his Win32 VM -- his answer of how
is quoted below.

-- Dwight

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
     Subject:  Re: UserIF and background processes (was: MVC Model)
        Date:  Fri, 17 Apr 1998 10:57:42 +0200 (MSZ)
        From:  Andreas Raab <raab at isgnw.cs.Uni-Magdeburg.DE>

> 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.

Andreas
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""





More information about the Squeak-dev mailing list