[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: image saving
On Thursday, July 25, 2002, at 07:38 PM, Chris Double wrote:
> What does 'save-image' actually do? I don't have a linux machine to try
> it out on.
>
> Does it create a new executable that when run has the current state of
> the running process? How does it handle open files, running threads,
> etc? Or does it assume that all files, threads and other resources are
> shut down?
>
> I see that there is an 'unexec' version for Windows NT as well. Does
> this not work under Windows at the moment (hence image saving not
> working in windows) or is it just untested? Anyone working on getting
> it going? If not, I might have a stab at it.
save-image simply copies the current heap into a new copy of the
executable, so that starting the new exe will be much faster as it
doesn't need to go through all the booting process. This has many
issues, none of which have been solved. 1) it doesn't copy
shared-libraries's heaps. 2) It doesn't handle open files/threads/etc at
all. 3) its not portable (although there is a libunexec now which I
haven't looked at yet but claims to abstract everything - it would
probably be a good idea to use that instead) 4) i'm sure there's more
cause this is such a big hack.
It was taken essentially verbatim from GNU emacs, which uses it only to
boot the program once and create an image. It only allows this in batch
mode, ie: no windowing system, no user I/O, no threads, etc. It tries to
make sure the system is in a basic enough state that nothing will break
by saving the heap.
I put that in GOO a long time ago, back when GOO took much much longer
to start up, way before threads or anything. Right now unexec is not
even enabled on linux. If it is resurrected, I'd suggest putting a
restriction similar to that of emacs: it should only ever be called very
early in the boot process, after all the core modules are loaded, but
before the REP loop starts, or any threads start, or any files that will
stay opened are opened. Emacs does this with a command-line argument.
james