Squeak does not do pre-emptive multitasking.

Peter Crowther Peter at ozzard.org
Sun Jun 11 07:39:30 UTC 2006


> From: Michael van der Gulik
> At the moment I'm just annoyed 
> that my low priority processes (I assume 10 is low and 80 is high...) 
> can lock up Squeak. With my 10-process test that I posted, 
> Squeak will 
> respond to a alt-., but sluggishly if at all. Theoretically it 
> shouldn't, but it does.

Ah, now I seem to recall that's a different problem.  In order to keep
the speed of bytecode execution high, I recall that not all bytecodes
check for possible context switches *at all*.  There's then a timer in
the VM that triggers much more rarely and forces a check, just in case
of a tight loop that blocks the UI.  Tight loops tend to produce
bytecode sequences that don't trigger checks, as I recall.  Real-life
code wouldn't cause the same problems.

I think a check is made during at least one of the method call and
return sequences.  Bryce would know more if so, as he'll probably have
cursed the fact as he was building Exupery!  I accept that the numbers
would increment more slowly, but a loop of the form "[self increment:
element]" with increment defined as "counts at: element put: ((counts
at: element) + 1)" might yield a more responsive system.

> - Process has a badly named instance variable - "myList".

Given that quiescent Processes are held on LinkedLists, it would seem to
be a reasonable name - what's up with it?

> - Processor -> quiescentProcessLists doesn't appear to be used in the 
> same way as the blue book describes. Infact, it appears to 
> not be used at all. Where are the process lists?

On my 3.9a image, this shows what I'd expect from last time I
investigated: one LinkedList per *quiescent* process that isn't waiting
elsewhere, such as on a Semaphore.  There's no central registry of
Processes, although a snapshot could always be obtained using Process
allInstances.  Other designs could cause garbage collection of completed
Processes to fail, remembering that this design is far older than any
notion of weak references.

Not saying this is How It Should Be, merely noting why (I think) it's
the way it is.

		- Peter



More information about the Squeak-dev mailing list