Berserk idleLoop in event handling?

Tim Rowledge tim at
Fri Jan 9 05:00:04 UTC 2004

"Andreas Raab" <andreas.raab at> wrote:

> You won't ever see that latency. When we see an empty event queue we
> stimulate the input semaphore which will force ioProcess to run right away
> (since ioProcess is running at higher priority). IOW, whenever you query for
> an event we make sure that if there is one you get one. Trust me, this stuff
> works.
Ah, yes, I see the line in #nextEventFromQueue. That's good when an
interactive loop is running somewhere, it'll keep things ticking. I
hadn't noticed it before.

I've managed to improve things a lot for my machine by making the
primrelinquish signal the inputSemaphore if any events came in as a
result of the event polling in the prim (remember this is a CMT OS no
threads for the IO, no interrupts). I don't signal for events gleaned
via the primGetNextEvent since we already got to primGetNextEvent
at that stage. The problem for me is that if primRelinquish or
primGetNext Event are not called _very_ frequently then my machine and
all the applications on it is DEADDEAD. To have a decently working
machine I need wimp_poll() called hundreds or better yet thousands of
time a second. Maybe I should investigate having a vm ticker trigger it
even if the image doesn't.

> The short version is: Remove EVERYTHING that relates to buffering (incl.
> event queue, ioProcess etc) and just use the get next event prim verbatim.
> Period. Since all VMs use sufficient event buffers, there is zero reason to
> do it in the image. All of this was done when there were no VMs with event
> support and internal buffering and we had to cope with all of the variations
> from Squeak.
Maybe I'll try it sometime on the road to the Great White North whilst
stuck in a blizzard. Got to have something to occupy the mind in a

So far I've improved performance in MVC to very reasonable and morphic
to tolerable. Certainly a lot better than it was, which is good. 

Tim Rowledge, tim at,
You don't have to know how the computer works, just how to work the computer.

More information about the Squeak-dev mailing list