I recognize this is a stretch, but I have a shadow of a memory of a way to do it, and I'm hoping someone here will recognize what I'm talking about and help jog it.
Traditional programs, both by terminal and GUI, have a starting sequence and a closing sequence of instructions, which can sometimes take some time to execute. Additionally, they may have other constraints, such as retrieving data from a database which may not always be available.
A "memory image" of a program, I am defining as its footprint in RAM while running. That is, a one-to-one mapping of all memory allocated to the program.
It is possible to image (and even mount the image of) a physical disk, to create an AppImage for an entire dependency structure, and to keep a virtual machine state (effectively an image) of the state of a virtual OS; so I may be wrong; but is it possible to save the memory state of a program (warts, inefficiency, and all) to a binary file?
(One of my concerns is that some references kept by the image may change between boots, but this is technically a solvable problem and might not disqualify the idea.)
If so, how would I go about doing this on a *nix system?
It clearly isn't always (or even usually) an advantage, but I feel it bears investigation. To illustrate what I am trying to do:
- Open
Vim - Write a lengthy amount of text in
Vim - Serialize Vim to disk without formally closing it
- Wait several days
- Deserialize instance of
Vimfrom disk - Continue writing the same text
So, save the state of the whole program, instead of just the file.
One workaround I thought of is to run the program in a virtual instance, but this feels like it might typically be excessive.