Idling on high -- an event driven Squeak?

Maloney johnm at wdi.disney.com
Mon Apr 20 09:10:12 UTC 1998


>At 02:14 PM 4/19/98 -0500, Paul Fernhout wrote:
>>Tom Morgan wrote:
>>> -I notice that the image 'idles on high', so to speak,
>>> on the Unix machine. 
>>> Has anyone given this any thought, especially for headless operation?
>>> I can spend some time on this, but I need some pointers into marrying
>>> some OS event handling to the interpreter loop.
>>
>>Tom -
>>
>>There was talk on reducing idle cpu useage issue many months back and
>>the solutions seemed to focus on tuning how much Squeak slept while
>>polling for events. Especially with the new code for network semaphores
>>and such, I think people were able to get idle processing down to less
>>than 10% or so. Someone working on a Squeak web server could probably
>>give more details and the current state of affairs.
>
>If anyone has more information on this, I'd be very interested to know it.
>I'm running Squeak to support a Swiki on an Indy, and CPU use is very high.
> I'd like my Hypermedia students to use a Swiki, but the Indy also serves
>as Web server for a number of Web sites for courses (including my own!).
>So CPU use is important.
>
>-- Louise 

How much CPU Squeak consumes when idling in the UI depends on the
platform. On the Mac and Win95, it is quite low; on Unix it is
apparently pretty high.

However, if you're running a server, the server thread spends most
of its time waiting on socket semaphores and since you're not using
the UI, you simply want to keep the UI thread from using up cycles.
Andreas suggested one simple solution: run the server loop in the UI
thread. Another solution is to just evaluate:

	[true] whileTrue: [(Delay forSeconds: 10) wait].

in a workspace. This does one cycle of the loop every 10 seconds,
which uses negligible CPU. You can get your UI back by hitting the
break key (ctrl-C on Unix, I suspect) *without* stopping the
server. This trick can be used even if you are not running a
server (say you just want to minimize your Squeak window while
you do something else).

Let me know if this helps; I don't have access to Unix machine
on which to try this to see how much the CPU usage drops.

	-- John





More information about the Squeak-dev mailing list