Help with threads

John M McIntosh johnmci at smalltalkconsulting.com
Mon Jan 23 05:20:16 UTC 2006


On 22-Jan-06, at 4:40 PM, Ron Teitelbaum wrote:

> The comments on Processor>>yield says use to allow processing on a  
> process
> with the same priority.  Why is it that this didn't work even  
> though they
> are not the same priority?  Since A thread is at the active  
> priority, and B
> and C are at background, wouldn't a yield on A allow processor time  
> to B and
> C?

What happens is that thread A looks for another thread to run in it's  
priority group, if any exist it
sticks itself last on the that priority list and calls  
wakeHighestPriority which does what it's  name suggest, find the  
highest priority task that can run.
If no other processes in it's priority group are available it does  
not switch.

I'll note the comment in yield says:
"Give other Processes at the current priority a chance to run."

A bit misleading since the intent is to given processes at the  
current priority a chance to run, but when it attempts to do that it  
may run a higher priority thread instead.
However it does NOT run lower priority tasks.

--
======================================================================== 
===
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