Help with threads
John M McIntosh
johnmci at smalltalkconsulting.com
Sun Jan 22 08:59:58 UTC 2006
Ah, well your generic smalltalk implementation has a simple scheduler.
It does a round robin scheduling on the link list of processes ready
to run sorted by priority.
See Interpreter>>primitiveYield & Interpreter>>wakeHighestPriority
by yielding in a high priority task which is not waiting for anything
just restarts that process and starves the lower priority processes.
If all three threads ran at the same priority then each would get
some run time
Being smalltalk you can of course alter things and add a revised
scheduler that uses suspend/resume or alter priorities to do process
escalation and other
features of more advanced schedulers.
However in your case you need to evaluate what your high priority
task is doing? Should it be running non-stop, or waiting for the
lower priority tasks to do something?
On 21-Jan-06, at 8:30 PM, Ron Teitelbaum wrote:
> All,
>
>
>
> I have three threads, the active thread and two at
> systemBackgroundPriority. It appears that the primary thread is
> preventing the others from running (I’m running tests in SUnit, and
> the method in question is setup).
>
>
>
> I first thought that adding Processor yield would work but it
> appears from the method comments, and my tests, that this doesn’t
> work.
>
>
>
> I added (Delay forMilliseconds: 10) wait. and this worked.
>
>
>
> What is the proper way to allow background thread to operate and
> get some processor time when there is an active processing running.
>
>
>
> Thanks for your help,
>
>
>
> Ron Teitelbaum
>
> Ron at USMedRec.com
>
>
--
========================================================================
===
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
========================================================================
===
More information about the Squeak-dev
mailing list
|