generalized suspend wanted
sjc at mordor.UUCP
sjc at mordor.UUCP
Fri Mar 2 06:10:39 AEST 1984
While it does not provide a generalized suspend capability, a program
called "undump" sometimes suffices. To use it, you coredump the process
that you want to suspend, and then run "undump", converting the core file
back to "a.out" format. The disadvantages are:
1. It takes time to coredump and convert a program, so one
does not lightly resort to this.
2. The reconstituted program starts at the beginning, no matter
where it was executing when it coredumped. Thus, you must
design the program with this in mind. It should catch the QUIT
signal, continue running until it is in a well-defined state
(e.g. with files flushed and closed), record in a static
variable the information it will need to restart, and then
coredump. At the beginning of the program, one can check this
static variable to see whether the program is actually being
restarted and, if so, one can "branch forward" (e.g. reopen
files, set flags, etc.) to resume.
For an interactive program, another solution is to prohibit QUIT
signals, but provide a user command which causes the program to
put itself in a well-defined state and coredump. (This can make
restarting particularly easy, if your program happens to be in
a well-defined, fairly quiescent state when awaiting user input.)
Despite these substantial restrictions, I know of at least two programs
which make profitable use of this scheme. One is the TeX text formatter
distributed by Richard Furuta (Furuta at WASHINGTON.ARPA, or
...decvax!uw-beaver!uw-june!furuta); the "undump" program comes with it.
To install the formatter, you run it, load the standard macro package
from a file, coredump it, and undump it. Then you give the undumped
version to users, who are spared the nuisance and delay of loading the
macro package each time they format a document. Another example is a
program here which lets you load an enormous but rarely changed
database, format a display to your liking, and then type a command
called "bedtime" to coredump the result. Then you undump that to make a
customized version for routine use.--Steve
(S-1 Project, Lawrence Livermore National Laboratory)
MILNET: sjc at s1-c UUCP: ...!decvax!decwrl!mordor!sjc
More information about the Comp.unix.wizards
mailing list