Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site mordor.UUCP Path: utzoo!watmath!clyde!floyd!harpo!seismo!ut-sally!mordor!sjc From: sjc@mordor.UUCP Newsgroups: net.unix-wizards Subject: Re: generalized suspend wanted Message-ID: <1488@mordor.UUCP> Date: Thu, 1-Mar-84 15:10:39 EST Article-I.D.: mordor.1488 Posted: Thu Mar 1 15:10:39 1984 Date-Received: Sat, 3-Mar-84 07:40:57 EST Organization: S-1 Project, LLNL Lines: 41 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@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@s1-c UUCP: ...!decvax!decwrl!mordor!sjc