[Newbies] Block other processes?
johnson at cs.uiuc.edu
Sun Aug 19 02:46:29 UTC 2007
On 8/18/07, John Almberg <jalmberg at identry.com> wrote:
> I guess another way to ask this question is: is it possible for
> Squeak to steal cycles from an Object's 'step' process, while the
> step is running, or does the Object have control until the step
This is not the way that Squeak works.
Objects do not have a step process. Squeak objects don't know much
about processes or execution. Squeak has processes, semaphores, etc.
and they are objects, but most objects don't have anything to do with
them. Every process has a priority. Squeak runs a process until the
process stops or a higher-priority process is ready to run. You can
make Squeak implement a round-robin scheduler by having a
higher-priority process wait on a timer and, when it wakes up, stop
the process that it just implemented and let the next process run.
This is probably not a good idea because most code in Squeak is not
threadsafe and does not expect to be interrupted. But it can be done.
Look at class Process and Semaphore. All the code that does this is
open and easily changed. Not necessarily easy to change without
breaking something, however!
More information about the Beginners