Alternative Thread Schedulers
John M McIntosh
johnmci at smalltalkconsulting.com
Wed May 30 17:02:27 UTC 2007
On May 29, 2007, at 11:08 PM, J J wrote:
> John gave a very nice write up of how the scheduling works. What I
> did not see was how to hook into it from Smalltalk. For example,
> if you call suspend, which calls primitiveSuspend the VM calls
> transferTo: and wakeHighestPriority but where does this come back
> into Smalltalk for handling?
wakeHigestPriority looks at the list of runnable processes which is a
sorted list by priority. Each element in the list is actually a
linked list
of processes that are able to run at that priority level. There is
an idle loop process at the bottom which when run means there is no
work to be done by the VM.
The idle task invokes a VM primitive to make the VM sleep. In the far
past this was a set amount of milliseconds, years ago it was changed
to sleep upto the next
Delay timing point, and/or wake if the operating system received an I/
O interrupt of some form assuming the operating system and sleep call
supports that.
What's important is what is the next runnable process. That can be
adjusted in the ProcessScheduler Smalltalk class by suspending
processes you don't want to run yet, or adjusting priorities to sort
the processes into something different.
--
========================================================================
===
John M. McIntosh <johnmci at smalltalkconsulting.com>
Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
========================================================================
===
More information about the Squeak-dev
mailing list
|