UserIF and background processes (was: MVC Model)

William O. Dargel wDargel at
Fri Apr 17 02:09:42 UTC 1998

Erik Gjovik wrote:

> Get this:
> Applications Programming in Smalltalk-80(TM):
> How to use Model-View-Controller (MVC)
> by
> Steve Burbeck, Ph.D.
> It is the best thing written on MVC that I have found

Yes, it is well written. It could be slightly better for use in learning
Squeak if the specifics on the MVC class hierarchy was for Squeak and
not VW 2.5. But still very worth while in understanding Squeak MVC. On
the other hand, given the move to Morphic...

It did get me looking at the flow of control of the user interface
process through the controllers though. Which brought up a number of
questions that I'm hoping someone out there can address. I'm using the
Windows version in case some of this is platform dependent.

The Controller>>controlLoop method does a "Processor yield" which will
let other processes at UserSchedulingPriority (priority 4 by the
numbers) run. 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.

    Does anyone use true background processes?
    How do you get them to run?

One thing I can think of is to put some wait for Delays in the UserIF,
but instead it really wants to be event driven somehow. I've worked in
Smalltalk V/286 which has a very similar MVC architecture. But there the
UserIF activity loop fetches InputEvents. It waits on a
KeyboardSemaphore (which allows background processes to run). The
KeyboardSemaphore get signaled by a KeyboardInterrupt which is signaled
by the VM whenever anything of possible interest happens with the
keyboard or mouse.

    Do we need a similar kind of event mechanism in Squeak?
    Is anyone working on such a thing?
    Or am I just missing something on using background processes with
the current polling mechanism?

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?

I also noticed that a long-running process can lock out the user
interface. If the process has higher than UserSchedulingPriority, or
even the same priority if it doesn't yield, the image is effectively
locked up. I couldn't find any way out short of using the Windows task
manager and blowing away the image. Again, back in V/286, a
control-break would interrupt in these situations with a debugger

    Is there any way to remain in Squeak and regain control in these
kind of situations?
    Where does the user interrupt (ctrl-break in my world) get passed
into the image?


    How might any of these things change in the move to Morphic?

Thanks. I'll appreciate any wisdom there is out there. Otherwise, I'll
just dig through the code some more. ... after all, it's all in there
....somewhere. [ Note to self: remember to resurface occasionally --
eating and periodic sleep may be required :-) ]


Bill Dargel            wdargel at
Shoshana Technologies
100 West Joy Road, Ann Arbor, MI 48105  USA

More information about the Squeak-dev mailing list