Preemptive scheduling
John M McIntosh
johnmci at smalltalkconsulting.com
Tue May 1 18:21:38 UTC 2007
Interpreter>>transferTo: is the place in the VM were we transfer
control from one process to another. This is invoked via
primitiveSuspend
primitiveWait
primitiveYield
resume:
for wait and yield it follows the pattern
self addLastLink: activeProc toList: processList.
self transferTo: self wakeHighestPriority
which means we stick the process at the end of the linked list of
processes in the same priority, thus if there was a higher process or
process at the same priority ready to run it will run instead of the
process that has the wait or yield. It could of course wake the same
process if the process is the only one in it's priority group and
it's ready to run of course.
for suspend, we don't do the addLastLink because the process is being
suspended.
In all of this the ProcessorScheduler does not do preemptive
scheduling, thus if you have a high priority smalltalk process that
runs away it will block all other
processes from running. You could of course and I've seen change
sets for Visualworks write your own scheduler that modifies what
wakeHighestPriority means by suspending processes that normally would
be runnable. That would be overhead, and what is the problem you are
trying to solve?
On May 1, 2007, at 10:48 AM, J J wrote:
> Hi all,
>
> Does the Squeak VM do preemptive scheduling or regular yield style
> scheduling. This may sound like a silly question, but I know
> Erlang is language that does mainly green threads and they are
> preemptive in nature. They accomplish this by allowing a given
> thread to execute no more then 100 VM instructions before it is
> preempted (obviously if a thread makes a primitive call that is a
> voluntary yield).
>
> Does Squeak do this already? I suspect not, and if I am correct,
> would there be any benefit in doing something like this or would it
> actually slow things down?
>
> Thanks,
> Jason
>
> _________________________________________________________________
> Don’t quit your job – Take Classes Online and Earn your Degree in 1
> year. Start Today! http://www.classesusa.com/clickcount.cfm?
> id=866146&goto=http%3A%2F%2Fwww.classesusa.com%2Ffeaturedschools%
> 2Fonlinedegreesmp%2Fform-dyn1.html%3Fsplovr%3D866144
>
>
--
========================================================================
===
John M. McIntosh <johnmci at smalltalkconsulting.com>
Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
========================================================================
===
More information about the Squeak-dev
mailing list
|