[squeak-dev] Re: Why do we process the shutdown list if not snapshotting?

Eliot Miranda eliot.miranda at gmail.com
Mon Apr 18 13:00:59 UTC 2016


Hi Tim, Tobias & Marcel,

> On Apr 18, 2016, at 12:47 AM, timfelgentreff <timfelgentreff at gmail.com> wrote:
> 
> No, you need three variables. Your scenarios are correct, I think, but 1 and
> 2 need to differentiate. If you're saving and quitting you want to compress
> forms and remove tmpdirs and such, but if you're saving and keeping the
> image open you want to skip the tmpdir removal, not close open sockets,
> maybe only set a variable for startup to re-init that stuff...

Ok so perhaps there are three states, but that doesn't imply three variables.  One would suffice if a symbol were used: #quit #save #saveAndQuit.

But is it feasible to ignore #save and expect startUp: to deal with the deferred clean up?  #save is not, and usefully /should not/ be a shut down.  To exit the system, any save must be followed by either a #quit or a #saveAndQuit.  So IMO #save should not shutDown:.  Here are two motivating examples 

1. Use of #save to produce a checkpoint, or produce an image to debug some issue at a later date.  In this case the image should be as close to the running image as possible.  Not shutting down in #save is required here.

2. Cleaning up C pointers.  It is common enough for applications to allocate external memory and refer to it through pointer objects (IIRC, Alien & ExternalAddress in Squeak et al, CPointer in VW).  These /cannot/ be released on #save, because doing so would force shutting down of external code that is using that memory.  So instead very early on startUp: all such referents are visited (eg via allInstances, or by enumerating a weak set) and their references are nilled (since the memory is released implicitly on #quit).

So IMO #save should /not/ run either the shutdown list or the startup list in the saving image, and should only run the startup list in the new resuming image.

This may require sophistication on behalf of the programmer, but the start up and shut down lists are indeed nontrivial things to program; they're often maintaining critical infrastructure such as the delay system, and total ordering is extremely important.  Good comments can help.

If you look at VW, you'll see use of pragmas to provide better plug fabulist in terms of providing a priority for ordering, and IIRC for prerequisites.  We could consider a similar approach.


_,,,^..^,,,_ (phone)
Eliot

> marcel.taeumel wrote
>> Hi there,
>> 
>> there are three different scenarios for shutdown:
>> 
>> 1. Save and resume
>> 2. Save and quit
>> 3. Quit only
>> 
>> For general clean-up routines, 1 and 2 should clean-up, while 3 does not
>> have to. So, one variable might be sufficient. :-)
>> 
>> Any other ways of using shutdown?
>> 
>> Best,
>> Marcel
> 
> 
> --
> View this message in context: http://forum.world.st/Why-do-we-process-the-shutdown-list-if-not-snapshotting-tp4890384p4890547.html
> Sent from the Squeak - Dev mailing list archive at Nabble.com.
> 


More information about the Squeak-dev mailing list