[squeak-dev] Are Squeak processes pre-emptive?

Eliot Miranda eliot.miranda at gmail.com
Tue Apr 13 16:46:49 UTC 2010


On Tue, Apr 13, 2010 at 9:24 AM, Randal L. Schwartz
<merlyn at stonehenge.com>wrote:

> >>>>> "Ang" == Ang BeePeng <beepeng86 at yahoo.com> writes:
>
> Ang> Are Squeak processes pre-emptive? Are infinite loop processes safe
> Ang> to run?
>
> Squeak uses a simple priority scheme.
>
> A Squeak process runs until it yields or it is interrupted by a higher
> priority process event.  When it is interrupted, it goes to the back of
> the queue, so when the higher priority process pauses or completes,
> other processes at the same priority are likely to be run instead.
>

IMO the sending of the preempted process to the back of the queue is a bug.
 It means one cannot rely on cooperative scheduling within a priority level.
 On the other hand, if the VM does not send the preempted process to the
back of the queue there is nothing to prevent a higher-priority process
altering the run queues of lower priority processes, achieving the same
thing.  But it is flexible if the scheduler code does it rather than the VM.
 One can imagine per-process priorities being examined so that by default a
process gets moved to the back of its run queue when preempted, but if a
process has a "don't preempt me" property it is not.

FWIW VisualWorks has not moved preempted processes to the back of the
run-queue since ObjectWorks 2.3, the last BlueBook compatible release.


best
Eliot


>
> So, it's safe to run an infinite loop, but be sure that anything that
> should interrupt it is at a higher priority.  And if you're running
> *two* infinite loops at the same priority, you need something that will
> just interrupt regularly.
>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
> <merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
> Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
> See http://methodsandmessages.vox.com/ for Smalltalk and Seaside
> discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20100413/9fa03275/attachment.htm


More information about the Squeak-dev mailing list