Suspending/resuming processes

Igor Stasenko siguctua at gmail.com
Thu Dec 20 17:15:48 UTC 2007


Hello again,

I don't know much detail of Processes but i found one thing which i don't like.

A calls to suspend/resume can't be nested e.g.
suppose given code:

proc suspend  < -- suspends process
proc suspend  < -- does nothing
proc resume   < -- resumes process
proc resume  < -- unknown

i think it would be better to have a suspend counter, which will
indicate, how many times process has received #suspend, and resume it
only when when counter goes to zero.

This is essentially useful when you need to guarantee that process
will stay suspended even if it's currently suspended waiting for
semaphore signal.

I tried to modify a Launcher , to make it following:

1. just before image save, suspend all processes except current one
2. <save image>
3. if we resuming, run scripts/launch methods using provided command
line arguments
4. resume all previously suspended processes.

As you see, step 4 is counterpart of step 1.
In step 3, i need guarantee, that there is no other processes which
can interrupt execution of current process by all means before it will
finish execution.

But due to fact, that processes can't nest #suspend calls, this leads
to resume all processes unconditionally in step 4, regardless that
some of them are suspended and waiting for semaphore signal.

Please, let's not discuss how i can get around that issue. I'd like to
hear arguments for and against adding nesting capabilities of
suspend/resume methods.

-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list