Multithreaded Squeak

goran.hultgren at bluefish.se goran.hultgren at bluefish.se
Wed Nov 27 09:07:21 UTC 2002


Martin Drautzburg <martin.drautzburg at web.de> wrote:
> Ned Konz <ned at bike-nomad.com> writes:
> 
> > [ something doSomethingVeryTimeConsuming ] forkAt: Processor 
> > userBackgroundPriority.
> 
> I always wondered: is this preemtive ? I mean can a process run into a
> loop and lock the system preventing any other process to run or will
> it just eat up CPU and slow down the system ?

Well, I quote Stephane's free book:
http://www.iam.unibe.ch/~ducasse/WebPages/FreeBooks/ByExample/

"...is because processes are partially preemptive. A running process
will not be interrupted by another process of equal or lesser priority.
A process will keep running until it does a time consuming operation
such as waiting on a socket read or on an instance of Delay, or the
process explicitly gives up control, or a higher priority process is
ready to run."

So basically - if you have a Process running at a higher prio it will
preempt the lower ones. And using ProcessorBrowser (drag one out from
the right flap) you can "start CPU watcher" which is really good when
developing using Processes - otherwise you can pretty easily end up in a
tight little knot...

Btw, really cool Stephane with the free books!

regards, Göran

PS. Plug: SharedStreams are pretty nifty - haven't heard anyone using
them yet but they work like stream "pipes" between Processes. Like
SharedQueue for characters but without the bugs. ;-) Check the class
comments and class side examples. Very useful when doing Socket stuff
using multiple Processes. :-)




More information about the Squeak-dev mailing list