Threads or suggestion?

Tim Rowledge tim at sumeru.stanford.edu
Thu Aug 8 22:24:59 UTC 2002


"Stephen Pair" <spair at acm.org> is claimed by the authorities to have written:

> Perhaps this would be a nice feature to add to ProcessorScheduler?  You
> could do something like:
> 
> Processor startTimerPreemption: 100
> Processor stopTimerPreemption
> 
> The disadvantage here is that this always preempts after the specified
> time has elapsed.  It would be nice to have something that would
> interrupt the active process only if it has been running longer than the
> specified amount of time.  Couldn't something like this be done in
> checkForInterrupts?
One could certainly do something like this without huge effort in the
vm. However, one does need to be careful to make sure that what you get
is what you think you want.

First problem is making sure that preempting a process actually stops it
and starts another; for example VW sticks a suspended process at the
_front_ of the associated list, not at the back. Or at least it used to.
The argument was a long the lines of making sure that running processes
got a decent chance to proceed. Not sure I believed it.

Then we have to decide what happens in the degenerate case of a single
process at that priority; do we simply say it gets to go again
immediately? Or look at the next lower priority?

Perhaps the nastiest problem is deciding what to do about the bigger
picture of many processes and the fact that very little in the image is
threadsafe.

tim

-- 
Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
Any program that runs right is obsolete.




More information about the Squeak-dev mailing list