Suspending/resuming processes

Louis LaBrunda Lou at Keystone-Software.com
Fri Dec 21 15:19:57 UTC 2007


Hi,

I'm new to squeak, so I'm not sure how all this works in Squeak but I have had
occasion to look into how Process, ProcessorScheduler, Semaphore and Delay work
in VA Smalltalk.  They all work closely together.  ProcessorScheduler handles
the scheduling, suspending and resuming of Processes.

The scheduler keeps a list (an array of queues, one for each priority level) of
ready to run processes.  A wait on a Semaphore or Delay removes (via #suspend) a
process from the ready to run list and keeps track when to add it back (via
#resume).  In Squeak, Delay uses a Semaphore, so these classes are even more
closely tied than in VAST.

>> The #resume should be no-op if process was not suspended by previous
>> call of #suspend.
>> But currently, by sending #resume to process which waiting for signal
>> causing it to continue running as if signal raised.
>
>That is a bug and should be fixed.

In VAST resuming a terminated process is a no-op in Squeak it looks like it is
an error.  In both, resuming a suspended process is a no-op, I don't see the bug
here.  Again, waiting on a Semaphore or Delay does a #suspend, so sending
#resume to a process waiting on a Semaphore or Delay will bring the process out
of its suspended state.  Changing this behavior would be a big deal and I don't
see a good reason for the change.

I think that in Squeak #isSuspended (maybe not the best name) will tell you if a
process is waiting on a Semaphore or a Delay, if you don't want it to resume
prematurely, don't send it a #resume.

Lou
-----------------------------------------------------------
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:Lou at Keystone-Software.com http://www.Keystone-Software.com




More information about the Squeak-dev mailing list