Alternative Thread Schedulers

John M McIntosh johnmci at smalltalkconsulting.com
Fri Jun 1 16:56:35 UTC 2007


On Jun 1, 2007, at 7:54 AM, Lex Spoon wrote:

> 2. Possible make your own "idle" process, one notch above the current
>    idle process, so that you can detect a lack of activity.  This
>    process can wake up the high-priority one, if you want, by
>    signalling a semaphore that the high-priority one notices.

Ah, this is good. Don't fiddle with the system's idle process. Many  
years ago I tried that, we even pushed the
change out, followed a few hours later by an emergency fix. The  
intent was to change the idle logic from sleeping
a default of 10 ms (or something) to sleeping up to the next wakeup  
Delay timing point.

We discovered (Scott did I think) that the code in Smalltalk which  
went off to find out that information *could* if
the objects aligned right then wait on the Delay semeaphore. Which  
then result in the VM terminating because
there was no runnable process since the idle process was stalled  
waiting on the Delay semaphore.

A few years after this we did put back in logic in the VM idle  
primitive to get the next wakeup time because the
VM was handed that information as part of the Delay logic. Thus it  
can sleep upto the next wakeup tick, baring
interrupts from the operating system which terminate the operating  
system's sleep api logic early. That improved
Delay accuracy and reduced CPU needs for idle system.

--
======================================================================== 
===
John M. McIntosh <johnmci at smalltalkconsulting.com>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
======================================================================== 
===





More information about the Squeak-dev mailing list