Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Variable persistence for suspend-and-resume programs

by tlm (Prior)
on Jul 24, 2005 at 00:11 UTC ( #477529=note: print w/replies, xml ) Need Help??


in reply to Variable persistence for suspend-and-resume programs

In the past, when I've needed this sort of thing, I've structured my code so that there's a well defined state object (which can be pretty complicated), and an "evolver" function that evolves the state object to some final condition. Then I simply use Storable to serialize and save the state object as needed.

This approach may represent a bigger burden on the programmer than what you propose, but I trust it more. After all, this functionality is, almost by definition, useful only with long, i.e. precious, runs. When days' worth of computation are at stake, I prefer to take it upon myself to work out the details of what constistutes a state, and how this state is evolved, etc., rather than letting this analysis be somehow automated after-the-fact. If I were to automate it, I'd go whole-hog and figure out how to save all the memory image to disk and restore it later.

BTW, I find checkpointing useful, but for reasons different from the ones you cite, e.g. suspending a job temporarily to give the CPU to something else. For these I just use kill -STOP/kill -CONT (yes, I'm a Unix creature). Also, GNU screen is invaluable for decoupling processes from login sessions. I often work on remote hosts, through connections that are not infinitely reliable; screen has saved my butt more often than I care to admit. (In fact, for all you Unix users out there, screen is one of those utilities, like Google, that once you start using it, you begin to wonder how anyone could live without it.)

the lowliest monk

  • Comment on Re: Variable persistence for suspend-and-resume programs

Replies are listed 'Best First'.
Re^2: Variable persistence for suspend-and-resume programs
by polettix (Vicar) on Jul 24, 2005 at 13:57 UTC
    I agree on the concerns only partially. Maybe an assembler programmer used to suspect of all those "high-level" languages, but today assembler is used only in a restricted portion of programmers world. What I mean is that I'm looking for some facility to portably handle my issue, which can of course be quite different from what I've coded above. To put it in another way, I'd like some way to factor out all the needs that a suspend-and-resume approach would have, in order to simplify the task the next time. Until then, I agree that it's something that I have to deal with with extreme care.

    I'm mostly a Linux guy, so the TSTP/CONT signaling would be fine most of the time. But sometimes my programs are used by less evolved guys, bound to use some legacy OS, which forces me to use it on that OS occasionally. The bottom line is that I was looking for something portable.

    Checkpointing would help here to save state at intermediate steps, of course. I consider this a nice side effect :)

    Flavio
    perl -ple'$_=reverse' <<<ti.xittelop@oivalf

    Don't fool yourself.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://477529]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2020-06-02 08:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (15 votes). Check out past polls.

    Notices?